3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class a{ function strip_slashes_recursive( $variable ) { if ( is_string( $variable ) ) return stripslashes( $variable ) ; if ( is_array( $variable ) ) foreach( $variable as $i => $value ) $variable[ $i ] = $this->strip_slashes_recursive( $value ) ; return $variable ; } } $a = new a(); $array = array("f\\'oo", "b\\'ar", array("fo\\'o", "koko" => "sadsa\\'dasd" , "b\\'ar")); $array = $a->strip_slashes_recursive($array); print_r($array); ?>
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [0] => f'oo [1] => b'ar [2] => Array ( [0] => fo'o [koko] => sadsa'dasd [1] => b'ar ) )