Req #68584 [Opn]: I hope "unset" keyword can be used after "or"
| From: | chx@php.net | Date: | Wed, 10 Dec 2014 08:24:47 +0000 |
| Subject: | Req #68584 [Opn]: I hope "unset" keyword can be used after "or" | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-188992@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68584&edit=1
ID: 68584
Updated by: chx@php.net
Reported by: 523826219 at qq dot com
Summary: I hope "unset" keyword can be used after "or"
Status: Open
Type: Feature/Change Request
-Package: PHP Language Specification
+Package: Scripting Engine problem
Operating System: Windows&&Linux
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
The specification describes the current behavior and this is a feature request against I guess PHP
7.
Previous Comments:
------------------------------------------------------------------------
[2014-12-10 07:10:19] 523826219 at qq dot com
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 this bug report at https://bugs.php.net/bug.php?id=68584&edit=1