php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #51984 new operation ?= for $var = $var ? $var :"hello world"
Submitted: 2010-06-03 08:52 UTC Modified: 2010-06-03 13:13 UTC
From: fortruth at mabang dot net Assigned: sjoerd (profile)
Status: Not a bug Package: Scripting Engine problem
PHP Version: trunk-SVN-2010-06-03 (SVN) OS:
Private report: No CVE-ID: None
 [2010-06-03 08:52 UTC] fortruth at mabang dot net
Description:
------------
as you have make ?: more easy. 
but I think there can be a more easy for other one.

like 

$var ?= "hello world";

there can be equal that 

$var = $var ? $var : "hello world";

for now short is 

$var = $var ? : "hello world";


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-03 09:27 UTC] fortruth at mabang dot net
and this maybe more useful for 

stand for:

if(!$var)$var = "hello world";
 [2010-06-03 13:04 UTC] sjoerd@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: sjoerd
 [2010-06-03 13:04 UTC] sjoerd@php.net
The ifsetor operator is planned for PHP6:
http://www.php.net/~derick/meeting-notes.html#ifsetor-as-replacement-for-foo-
isset-foo-foo-something-else
 [2010-06-03 13:13 UTC] pajoye@php.net
-Status: Closed +Status: Bogus
 [2010-06-03 13:13 UTC] pajoye@php.net
not really, we have ?: now, which does mostly what is requested here.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 19:01:30 2024 UTC