3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data_billding= array( 'first_name' => "<b>hello</b>", 'last_name' => "<i>hello</i>", 'email' => "\hello", 'phone' => "he\llo", 'address' => "<h1>hello</h1>", ); function change($value, $key){ $key = stripslashes(strip_tags($key)); $value = stripslashes(strip_tags($value)); global $a; $a = array($key => $value); //print_r($a); } array_walk_recursive($data_billding, "change"); print_r($a); function my_function($value){ return stripslashes(strip_tags($value)); } /*trả về array chứa value nếu hàm my_function trả về TRUe*/ print_r(array_filter($data_billding,"my_function")); ?>
Output for 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Array ( [address] => hello ) Array ( [first_name] => <b>hello</b> [last_name] => <i>hello</i> [email] => \hello [phone] => he\llo [address] => <h1>hello</h1> )

preferences:
176.7 ms | 403 KiB | 168 Q