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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: fortruth at mabang dot net
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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 Mar 28 16:01:29 2024 UTC