note 126515 added to function.current

From: Date: Tue, 19 Oct 2021 10:45:19 +0000
Subject: note 126515 added to function.current
Groups: php.notes 
Request: Send a blank email to php-notes+get-217087@lists.php.net to get a copy of this message
It looks like current() is deprectated for calling on objects since PHP 7.4. Consider this code ``` $a = new ArrayIterator([1,2,3]); var_dump(current($a), $a->current()); ``` It returns ``` int(1) int(1) ``` In PHP 7.3, but in PHP7.4 you get: ``` bool(false) int(1) ``` And in PHP8: ``` Deprecated: current(): Calling current() on an object is deprecated in /in/fdrNR on line 5 bool(false) int(1) ``` ---- Server IP: 45.112.84.4 Probable Submitter: 45.112.85.242 (proxied: 37.214.64.22) ---- Manual Page -- https://php.net/manual/en/function.current.php Edit -- https://main.php.net/note/edit/126515 Del: integrated -- https://main.php.net/note/delete/126515/integrated Del: useless -- https://main.php.net/note/delete/126515/useless Del: bad code -- https://main.php.net/note/delete/126515/bad+code Del: spam -- https://main.php.net/note/delete/126515/spam Del: non-english -- https://main.php.net/note/delete/126515/non-english Del: in docs -- https://main.php.net/note/delete/126515/in+docs Del: other reasons-- https://main.php.net/note/delete/126515 Reject -- https://main.php.net/note/reject/126515 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#217087) next »