php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #9202 Parse error when using terniary (?:) and unset()
Submitted: 2001-02-09 20:29 UTC Modified: 2001-03-17 01:35 UTC
From: mlr at mijoheto dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.0.3pl1 OS: Linux 2.2.14-5.0smp
Private report: No CVE-ID: None
 [2001-02-09 20:29 UTC] mlr at mijoheto dot com
<?
$avariable = "test";
$avariable=="test" ? $avariable .=" No problem with is_bool" : is_bool($avariable);
$avariable=="test" ? $avariable .=" No problem with isset" : isset($avariable);
$avariable=="test" ? $avariable .=" No problem with empty" : empty($avariable);
$avariable=="test" ? $avariable .=" Problem with unset" : unset($avariable);
echo $avariable;
?>

Output is
Parse error: parse error in /home/httpd/html/mlr/unsetProblem.php on line 6

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-09 22:45 UTC] mlr at mijoheto dot com
The documentation for Unset() states:
Description
int unset (mixed var [, mixed var [, ...]])
unset() destroys the specified variables and returns true. 

I have changed the type of this bug report to "Documentation Problem", since I have been informed that Unset is not a function. 

<?
$avariable = "test";
$avariable=="test" ? $avariable .=" No problem with is_bool" :
is_bool($avariable);
$avariable=="test" ? $avariable .=" No problem with isset" :
isset($avariable);
$avariable=="test" ? $avariable .=" No problem with empty" :
empty($avariable);
$avariable=="test" ? $avariable .=" Problem with unset" :
unset($avariable);
echo $avariable;
?>

Output is
Parse error: parse error in /home/httpd/html/mlr/unsetProblem.php on line 6
 [2001-03-17 01:35 UTC] jmcastagnetto@php.net
Documentation fixed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 03:01:32 2024 UTC