|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-08-28 20:14 UTC] requinix@php.net
-Type: Bug
+Type: Feature/Change Request
[2016-08-28 20:14 UTC] requinix@php.net
[2016-08-29 08:51 UTC] dailywatchdeal at gmail dot com
[2016-08-29 10:24 UTC] cmb@php.net
[2016-08-29 11:18 UTC] requinix@php.net
-Status: Open
+Status: Verified
-Type: Feature/Change Request
+Type: Bug
[2016-08-29 11:18 UTC] requinix@php.net
[2016-08-29 14:24 UTC] cmb@php.net
[2016-08-30 11:07 UTC] nikic@php.net
[2016-08-30 11:07 UTC] nikic@php.net
-Status: Verified
+Status: Closed
[2016-08-30 12:15 UTC] ab@php.net
[2016-09-13 04:09 UTC] stas@php.net
[2016-09-13 04:11 UTC] stas@php.net
[2016-10-17 10:08 UTC] bwoebi@php.net
[2016-10-17 10:08 UTC] bwoebi@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 17:00:02 2025 UTC |
Description: ------------ According to the docs, the ?? operator checks if the 1st operand exists and is not null. In other words, it's equivalent to isset. When used to check if a SimpleXMLElement node exists, it doesn't work. Test script: --------------- <?php $xml = new SimpleXMLElement('<root><elem>Text</elem></root>'); echo 'elem2 is: ' . ($xml->elem2 ?? 'backup string'); echo 'elem2 is: ' . (isset($xml->elem2) ? $xml->elem2 : 'backup string'); Expected result: ---------------- elem2 is: backup string elem2 is: backup string Actual result: -------------- elem2 is: elem2 is: backup string