|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-06-29 13:38 UTC] andrew at phantom dot uk dot net
Description:
------------
Allow statements to be separated by commas in single line if statements (when
omitting the braces)
Test script:
---------------
if ( isset($_GET['take_me_there']) )
header('location: /you_are_here.php'), exit;
Expected result:
----------------
The client would be redirected to www.yoursite.com/you_are_here.php and the
script would terminate execution.
Actual result:
--------------
Parse error: syntax error, unexpected ',' in /opt/lampp/htdocs/test.php on line 2
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 22:00:01 2025 UTC |
This leads to too many conflicts. For instance what should this code do: if (condition()) echo foo(), bar(); right now it prints the returned values from foo() and bar(). This can't be easily distinguished from your syntax. There are other similar cases. Such special case syntax also makes the language more complex with more special cases to mind.