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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
16 + 21 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 23:01:27 2024 UTC