note 129027 added to function.empty

From: Date: Thu, 09 Nov 2023 23:29:16 +0000
Subject: note 129027 added to function.empty
Groups: php.notes 
Request: Send a blank email to php-notes+get-220983@lists.php.net to get a copy of this message
The Example #2 empty() on String Offsets has an issue. The line with the code var_dump(empty($expected_array_got_string['some_key'])); is not the better way to exemplify. $expected_array_got_string is not actually an array, but a string or another type that when accessed like an array ($expected_array_got_string['some_key']), results in NULL, which is considered empty. The empty function is explained in this documentation only with references like if a "variable is considered empty if it does not exist or if its value equals false" Please, complete the documentation with the reference to NULL values. ---- Server IP: 45.112.84.4 Probable Submitter: 45.91.157.134 (proxied: 45.184.70.231) ---- Manual Page -- https://php.net/manual/en/function.empty.php Edit -- https://main.php.net/note/edit/129027 Del: integrated -- https://main.php.net/note/delete/129027/integrated Del: useless -- https://main.php.net/note/delete/129027/useless Del: bad code -- https://main.php.net/note/delete/129027/bad+code Del: spam -- https://main.php.net/note/delete/129027/spam Del: non-english -- https://main.php.net/note/delete/129027/non-english Del: in docs -- https://main.php.net/note/delete/129027/in+docs Del: other reasons-- https://main.php.net/note/delete/129027 Reject -- https://main.php.net/note/reject/129027 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#220983) next »