php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #10309 feature request
Submitted: 2001-04-12 15:26 UTC Modified: 2001-06-20 14:37 UTC
From: fabiankessler at usa dot net Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.4 OS: all
Private report: No CVE-ID: None
 [2001-04-12 15:26 UTC] fabiankessler at usa dot net
$a = 'foo';
$b = 'bar';

$c = (true) ? &$a : &$b;

=> syntax error, have to do

if (true) {
  $c = &$a;
} else {
  $c = &$b;
}

would be nice :)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-17 04:45 UTC] jmoore@php.net
try:

$c =& (true)? $a: $b;

might work better. Havnt tested it though.
 [2001-06-20 14:37 UTC] fabiankessler at usa dot net
no, gives a syntax error also. 
PHP Version 4.0.7-dev (and 4.0.5)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 11:01:33 2024 UTC