note 126004 added to function.empty

From: Date: Tue, 13 Apr 2021 04:33:10 +0000
Subject: note 126004 added to function.empty
Groups: php.notes 
Request: Send a blank email to php-notes+get-216277@lists.php.net to get a copy of this message
From manual: "Returns false if var exists and has a non-empty, non-zero value, aka falsey, see conversion to boolean. Otherwise returns true." Returns FALSE if var exists even with data in it? Does the following prove otherwise or is the error mine? <!DOCTYPE html> <html> <body> <?php $arr = array();$arr[0] = 'fred'; $arr = array();$arr[1] = 'joe'; $arr = array();$arr[2] = 'tom'; $arrB = array(); if (empty($arr)) echo '<br> $arr true'; else echo '<br> else $arr false'; if (empty($arrB)) echo '<br> $arrB true'; else echo '<br> else $arrB false'; ?> </body> </html> // outputs // else $arr false // $arrB true ---- Server IP: 45.112.84.4 Probable Submitter: 45.112.85.242 (proxied: 151.200.36.167) ---- Manual Page -- https://php.net/manual/en/function.empty.php Edit -- https://main.php.net/note/edit/126004 Del: integrated -- https://main.php.net/note/delete/126004/integrated Del: useless -- https://main.php.net/note/delete/126004/useless Del: bad code -- https://main.php.net/note/delete/126004/bad+code Del: spam -- https://main.php.net/note/delete/126004/spam Del: non-english -- https://main.php.net/note/delete/126004/non-english Del: in docs -- https://main.php.net/note/delete/126004/in+docs Del: other reasons-- https://main.php.net/note/delete/126004 Reject -- https://main.php.net/note/reject/126004 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#216277) next »