|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-03-11 04:49 UTC] bolk at hitv dot ru
Description: ------------ This is correct but no record in documentation: $test = 'Test'; list ($a, $b) = $test; echo $a.$b; Reproduce code: --------------- $test = 'Test'; list ($a, $b) = $test; echo $a.$b; Expected result: ---------------- it prints: Te PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 01:00:01 2025 UTC |
Funny side effect :)) By the way this behavior may cause some problem: function Test() { $res = some_user_func(); return count($res) == 1 ? $res[0] : $res; } list ($a) = Test(); If some_user_func returns "array(1,2)" then $a will contains '1' but if it returns array('Test') then $a will contains 'T'. I think it will be better if PHP cause notice or something in this way or make right type conversion.