|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2014-12-10 08:24 UTC] chx@php.net
 
-Package: PHP Language Specification
+Package: Scripting Engine problem
  [2014-12-10 08:24 UTC] chx@php.net
  [2015-06-08 19:54 UTC] cmb@php.net
  [2017-08-05 04:54 UTC] stas@php.net
 
-Status: Open
+Status: Suspended
  [2017-08-05 04:54 UTC] stas@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 20:00:01 2025 UTC | 
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]);