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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mlr at mijoheto dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Tue May 06 21:01:31 2025 UTC