I have the below each()
line in a PHP file on a server where I recently upgraded the PHP version from 5 to 7.
while(list($file, $info) = each($this->images))
The error below is thrown by the web server after the restart.
The
each()
function is deprecated. This message will be suppressed on further calls
What will be the correct way of re-writing the above line of code in PHP 7.2?
Thank you.
You should be able to swap out your each for a foreach in the most part.
<?php
foreach($this->images as $file => $info) {
// ...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With