note 116125 deleted from function.list by salathe
| From: | salathe@php.net | Date: | Wed, 12 Nov 2014 14:46:37 +0000 |
| Subject: | note 116125 deleted from function.list by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-200891@lists.php.net to get a copy of this message | ||
Note Submitter: oscar at foro5 dot com
----
The example states the following:
<?php
// list() doesn't work with strings
list($bar) = "abcde";
var_dump($bar);
// output: NULL
?>
If the string is in a variable however, it seems using list() will treat the string as an array:
<?php
$string = "abcde";
list($foo) = $string;
var_dump($foo);
// output: string(1) "a"
?>
This is because strings behave as arrays
$name = "oscar";
Is like $name[0] = "o", $name[1] = "s", etc...