|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-02-04 22:16 UTC] jani@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 02 22:00:02 2025 UTC |
Description: ------------ I'm not sure if this is a bug or not but the bottom code works fine... The top one I try to merge two statements and it does not work... Shows Strict Standards: Only variables should be passed by reference in z.php on line 3 But it works if you separate the statements... I know this is not how you would normally code any of this stuff... It just seems weird there is an error... Reproduce code: --------------- <?php $file = '/path/to/some/file.ext'; $extension = array_pop($fileParts = explode('.', basename($file))); //Strict Standards: Only variables should be passed by reference in z.php on line 3 echo $extension . "\n"; // This works, echoes 'ext' echo count($fileParts); // Value is 2 ?> <?php $file = '/path/to/some/file.ext'; $fileParts = explode('.', basename($file)); $extension = array_pop($fileParts); echo $extension . "\n"; // This works, echoes 'ext' echo count($fileParts); // Value is 1 ?> Expected result: ---------------- I expect not to get a strict error cause both are the same... If it works for the bottom one, it should work for the top one...