note 117266 added to function.isset
| From: | andreasonny83 at gmail dot com | Date: | Tue, 12 May 2015 11:26:50 +0000 |
| Subject: | note 117266 added to function.isset | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-202505@lists.php.net to get a copy of this message | ||
Here is an example with multiple parameters supplied
<?php
$var = array();
$var['val1'] = 'test';
$var['val2'] = 'on';
if ( isset( $var['val1'], $var['val2'] ) && $var['val2'] ===
'on' ) {
unset( $var['val1'] );
}
print_r( $var );
?>
This will output:
Array
(
[val2] => on
)
The following code does the same calling "isset" 2 times:
<?php
$var = array();
$var['val1'] = 'test';
$var['val2'] = 'on';
if ( isset( $var['val1'] ) && isset( $var['val2'] ) &&
$var['val2'] === 'on' ) {
unset( $var['val1'] );
}
print_r( $var );
?>
----
Server IP: 72.52.91.14
Probable Submitter: 54.171.157.189
----
Manual Page -- http://php.net/manual/en/function.isset.php
Edit -- https://master.php.net/note/edit/117266
Del: integrated -- https://master.php.net/note/delete/117266/integrated
Del: useless -- https://master.php.net/note/delete/117266/useless
Del: bad code -- https://master.php.net/note/delete/117266/bad+code
Del: spam -- https://master.php.net/note/delete/117266/spam
Del: non-english -- https://master.php.net/note/delete/117266/non-english
Del: in docs -- https://master.php.net/note/delete/117266/in+docs
Del: other reasons-- https://master.php.net/note/delete/117266
Reject -- https://master.php.net/note/reject/117266
Search -- https://master.php.net/manage/user-notes.php