note 89780 deleted from function.isset by googleguy
| From: | googleguy@php.net | Date: | Sat, 19 Jan 2013 03:54:27 +0000 |
| Subject: | note 89780 deleted from function.isset by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-193267@lists.php.net to get a copy of this message | ||
Note Submitter: alexander dot holmback at gmail dot com
----
<?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.