|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-01-23 14:27 UTC] laruence@php.net
[2012-01-23 14:27 UTC] laruence@php.net
-Status: Open
+Status: Bogus
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 06 09:00:02 2025 UTC |
Description: ------------ PHP behaves differently with the code given in a file and in a parameter provided with -r php -r ignores variables, partially recognizes scalar type hinting. Test script: --------------- [root@devel data]# php -r "echo 1;" 1[root@devel data]# php -r "$x=3;" Parse error: syntax error, unexpected '=' in Command line code on line 1 # php -r "var_dump($x);" Warning: Wrong parameter count for var_dump() in Command line code on line 1 # php -r "function foo(int $a){}" Parse error: syntax error, unexpected '(int )' (int) (T_INT_CAST), expecting '(' in Command line code on line 1 Expected result: ---------------- 1 Actual result: -------------- Parse errors