|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-04-27 02:58 UTC] judas dot iscariote at gmail dot com
[2007-05-01 18:28 UTC] colder@php.net
[2008-07-24 09:08 UTC] schmidt@php.net
[2020-02-07 06:10 UTC] phpdocbot@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 19 21:00:01 2025 UTC |
Description: ------------ clarification is needed in the documentation in the case of a one-to-one assignment using list() and a string. see reproduction code example 1. i understand that in this case, the string is being treated as an array of characters. But this was not as expected initially. Plus, a fatal error is generated if the string is directly provided instead of returning from a function. Inconsistent and confusing. Reproduce code: --------------- Example 1: <?php function bob_dole_is_a_dork() { return 'Bob Dole Smells Like Old Socks!'; } list($bobdole) = bob_dole_is_a_dork(); echo($bobdole); ?> Example 2: <?php list($bobdole) = 'Bob Dole Smells Like Old Socks!'; echo($bobdole); ?> Expected result: ---------------- Example 1: Bob Dole Smells Like Old Socks! Example 2: Bob Dole Smells Like Old Socks! Actual result: -------------- Example 1 gives: B Example 2 gives: Fatal error: Invalid opcode 98/1/1. in /the/path/doesnt/matter/pp.php on line 2