| 
 
 
 | 
| Keep Server Online 
 If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
 
 or
 
 
   
 A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
 
 Thank You! Steffen
 
 Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
 |  | 
 | 
| | 
| | 
|  Topic: php 7.2.0 beta 3  bugs ? The each() function is deprecated |  |  
| Author |  |  
| spser 
 
 
 Joined: 29 Aug 2016
 Posts: 97
 
 
 | 
|  Posted: Wed 23 Aug '17 9:25    Post subject: php 7.2.0 beta 3  bugs ? The each() function is deprecated |   |  
| 
 |  
|  	  | Code: |  	  | <?php $foo = array("Robert" => "Bob", "Seppo" => "Sepi");
 $bar = each($foo);
 | 
 
 Error:
 -------------------------
 Type: E_DEPRECATED[8192]
 Mess: The each() function is deprecated. This message will be suppressed on further calls
 
 Find solutions
 |  |  
| Back to top |  |  
| Mandrake 
 
 
 Joined: 11 Dec 2013
 Posts: 4
 Location: Denmark, Copenhagen
 
 | 
|  Posted: Wed 23 Aug '17 9:45    Post subject: |   |  
| 
 |  
| You should probably use foreach instead or perhaps iterators if you need more control of the looping. |  |  
| Back to top |  |  
| Jan-E 
 
 
 Joined: 09 Mar 2012
 Posts: 1283
 Location: Amsterdam, NL, EU
 
 | 
|  Posted: Thu 24 Aug '17 8:59    Post subject: |   |  
| 
 |  
| Or fool yourself and silence the warning: 
 
  	  | Code: |  	  | <?php $foo = array("Robert" => "Bob", "Seppo" => "Sepi");
 $bar = @each($foo);
 
 | 
 This is likely to fail in PHP 7.3 or 8.0, so you'd better switch to foreach(), array_keys() / array_values() or something like that.
 |  |  
| Back to top |  |  
 
 | 
 |  | 
 |  |