Req #68584 [NEW]: I hope "unset" keyword can be used after "or"

From: Date: Wed, 10 Dec 2014 07:10:19 +0000
Subject: Req #68584 [NEW]: I hope "unset" keyword can be used after "or"
Groups: php.standards 
Request: Send a blank email to standards-+get-588@lists.php.net to get a copy of this message
From: 523826219 at qq dot com Operating system: Windows&&Linux PHP version: Irrelevant Package: PHP Language Specification Bug Type: Feature/Change Request Bug description:I hope "unset" keyword can be used after "or" Description: ------------ <?php $myDS=array(1,2,3); false===($targetKey=array_search(3,$myDS)) or var_dump($targetKey); // outputs:2 false===($targetKey=array_search(3,$myDS)) or unset($myDS[$targetKey]); // Fail:this is a syntax error!(Actually I just want to remove the target element with specified value from the array-$myDS,but it does not work!) Test script: --------------- <?php $myDS=array(1,2,3); false===($targetKey=array_search(3,$myDS)) or var_dump($targetKey); // outputs:2 false===($targetKey=array_search(3,$myDS)) or unset($myDS[$targetKey]); // Fail:this is a syntax error!(Actually I just want to remove the target element with specified value from the array-$myDS,but it does not work!) =>So ,I hope "unset" keyword can be used after "or" keyword,Thank you ! Expected result: ---------------- Actually "exit" keyword can be used after "or" keyword,why not "unset"? for example: !defined('IN_MANAGE') or exit('no access for this site!'); // works successfully I hope "unset" keyword can be used after "or" keyword,Thank you ! for example: !isset($somekey) or unset($myDS[$somekey]); Actual result: -------------- Actually "exit" keyword can be used after "or" keyword,why not "unset"? for example: !defined('IN_MANAGE') or exit('no access for this site!'); // works successfully I hope "unset" keyword can be used after "or" keyword,Thank you ! for example: !isset($somekey) or unset($myDS[$somekey]); -- Edit bug report at https://bugs.php.net/bug.php?id=68584&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68584&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68584&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68584&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=68584&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=68584&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=68584&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=68584&r=needscript Try newer version: https://bugs.php.net/fix.php?id=68584&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=68584&r=support Expected behavior: https://bugs.php.net/fix.php?id=68584&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=68584&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=68584&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=68584&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68584&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=68584&r=dst IIS Stability: https://bugs.php.net/fix.php?id=68584&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=68584&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=68584&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=68584&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=68584&r=mysqlcfg

« previous php.standards (#588) next »