isset

( unknown )

isset -- Determine whether a variable is set

Description

bool isset ( mixed var [, mixed var [, ...]])

הערה: isset() is a language construct.

 
?php

 
$a

 
=

 
"

 
test"

 
;

 
$b

 
=

 
"anothertest"

 
;

 
echo

 
isset

 
($a)

 
;

 
/

 
/

 
TRUE

 
echo

 
isset

 
($a

 
,

 
$b)

 
;

 
/

 
/TRUE

 
unset

 
($a)

 
;

 
echo

 
isset

 
($a)

 
;

 
/

 
/

 
FALSE

 
echo

 
isset

 
($a

 
,

 
$b)

 
;

 
/

 
/FALSE

 
$foo

 
=

 
NULL

 
;

 
print

 
isset

 
($foo)

 
;

 
/

 
/

 
FALSE

 
?





 
?php

 
$a

 
=

 
array

 
(

 
'test

 
'

 
=

 
1

 
,

 
'hello

 
'

 
=

 
null)

 
;

 
echo

 
isset

 
($a['test'])

 
;

 
/

 
/

 
TRUE

 
echo

 
isset

 
($a['foo'])

 
;

 
/

 
/

 
FALSE

 
echo

 
isset

 
($a['hello'])

 
;

 
/

 
/

 
FALSE

 
echo

 
array_key_exists('hello'

 
,

 
$a)

 
;

 
/

 
/

 
TRUE

 
?





See also empty( ) , unset( ) , and array_key_exists( ) .