note 128296 added to control-structures.foreach

From: Date: Tue, 07 Mar 2023 01:20:17 +0000
Subject: note 128296 added to control-structures.foreach
Groups: php.notes 
Request: Send a blank email to php-notes+get-220253@lists.php.net to get a copy of this message
please note: foreach would treat keys as numbers in some cases. $temp = array('A'=>'Apple', '2'=>'Two', 'C' =>'Cat'); $haystack = 'a2c'; foreach($temp as $key=>$value) { if (stripos($haystack, $key)!==false) echo $value; } //output: AppleCat ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.13.130 (proxied: 113.70.208.55) ---- Manual Page -- https://php.net/manual/en/control-structures.foreach.php Edit -- https://main.php.net/note/edit/128296 Del: integrated -- https://main.php.net/note/delete/128296/integrated Del: useless -- https://main.php.net/note/delete/128296/useless Del: bad code -- https://main.php.net/note/delete/128296/bad+code Del: spam -- https://main.php.net/note/delete/128296/spam Del: non-english -- https://main.php.net/note/delete/128296/non-english Del: in docs -- https://main.php.net/note/delete/128296/in+docs Del: other reasons-- https://main.php.net/note/delete/128296 Reject -- https://main.php.net/note/reject/128296 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#220253) next »