Skip to content
Advertisement

Deprecated each in code igniter xssclean helper

I have a codeigniter helper called xssclean for input validating form data

If i give array it show each deprecated error.

Here is my function in my xssclean_helper.php

JavaScript

At line no 3 i get error

Advertisement

Answer

The each() function is deprecated with PHP 7.2. But you can replace your while-loop with a foreach-loop:

JavaScript

The $value variable is per default a copy of the array value. The & makes it a reference, this way you can update the value. Manipulating the array while iterating over it, is not a good idea and can lead to errors.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement