Skip to content

Tag: multidimensional-array

PHP wrong foreach code

What I have done wrong, foreach code written below, but it seems not working: What I have to change in this foreach code? Thanks Answer first line, custom is not a variable (could be copy and paste error) Then you are splitting a string using can array operator, you need to split that string first using: Then…

Sanitize & desanitize multidimensional array

I have the following class I wrote: The problem is that while it works on strings and one-dimensional arrays, I get the following error with multidimensional arrays: Warning: htmlspecialchars() expects parameter 1 to be string, array given in C:wampwwwclassesSanitizer.php on line 10 How do I fix this? Any hel…