php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #6268 ternary op return only by value
Submitted: 2000-08-20 21:06 UTC Modified: 2014-10-12 14:22 UTC
Votes:3
Avg. Score:2.3 ± 0.9
Reproduced:0 of 0 (0.0%)
From: waldschrott@php.net Assigned:
Status: Wont fix Package: Scripting Engine problem
PHP Version: 4.0 Latest CVS (20/08/2000) OS: *
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: waldschrott@php.net
New email:
PHP Version: OS:

 

 [2000-08-20 21:06 UTC] waldschrott@php.net
don?t know if it?s possible to change nor if it?s needed - just noticed that it?s not possible... I think ternary returns values and not references only, don?t know a solution other than maybe a ?& b:c
all other functions can return references, ? can?t, although it is an operator, it is used function-like

<?php
$test1=1;
$test2=2;
$test3=3;
echo $x =& $test ?	$test2:$test3;
echo $x;
$x=5;
echo $test3;
?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-19 00:07 UTC] jani@php.net
-Package: Feature/Change Request +Package: Scripting Engine problem
 [2014-10-12 14:22 UTC] nikic@php.net
-Status: Open +Status: Wont fix
 [2014-10-12 14:22 UTC] nikic@php.net
Closing as this is by-design. Ternary is an expression so it returns values.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 14:01:27 2025 UTC