note 89780 modified in function.isset by danbrown
| From: | danbrown@php.net | Date: | Mon, 23 Mar 2009 13:10:43 +0000 |
| Subject: | note 89780 modified in function.isset by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-152325@lists.php.net to get a copy of this message | ||
<?php
$abc = 'test';
?>
$abc is not an array, but you can use the brackets to reach a single byte in the string using
numbers.
<?php
$abc[0] = 't' //first letter in 'test'
$abc[1] = 'e' //second letter in 'test'
$abc[2] = 's' //third letter in 'test'
$abc[3] = 't' //fourth letter in 'test'
?>
When using $abc['astring'], php will cast any string to 0 (see type juggling) which result
in the letter 't' which indeed is set.
isset($abc['astring'] = isset($abc[0]) = true.
--was--
$abc = 'test'
$abc is not an array, but you can use the brackets to reach a single byte in the string using
numbers.
$abc[0] = 't' //first letter in 'test'
$abc[1] = 'e' //second letter in 'test'
$abc[2] = 's' //third letter in 'test'
$abc[3] = 't' //fourth letter in 'test'
When using $abc['astring'], php will cast any string to 0 (see type juggling) which result
in the letter 't' which indeed is set. isset($abc['astring'] = isset($abc[0]) =
true.
http://php.net/manual/en/function.isset.php