changing array values recursively in PHP -


i'm trying change values of array recursevely , examples i've seen in stackoverflow don't fit want far.

basically, want translate boolean string.

foreach($this->data $key=>$value) {     if (is_bool($value))     {         $this->data[$key] = var_export($value, true);     }        } 

this works in first level of array. also, i've tried change values array_walk_recursive no success well.

thanks in advance.

array_walk_recursive() should easily

array_walk_recursive(     $myarray,     function (&$value) {         if (is_bool($value)) {             $value = 'i boolean';         }     } ); 

demo


Comments

Popular posts from this blog

gcc - MinGW's ld cannot perform PE operations on non PE output file -

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

c# - Search and Add Comment with OpenXML for Word -