3v4l.org

run code in 300+ PHP versions simultaneously
<?php function slashit(&$aray, $db_link) { foreach ($aray as $key => $value) if(is_array($value)) slashit($value, $link); else $aray[$key] = mysql_real_escape_string($value, $db_link); } // Test: $fruits = array ( "fruits" => array("a" => "or'ange", "b" => "ban'ana", "c" => "apple'"), "numbers" => array(1, 2, 3, 4, 5, 6), "holes" => array("fir'st", 5 => "sec'ond", "thir'd"), "odma" => "jugo'slavija" ); // You have to make link to the database or can use addslashes instead of mysql_real_escape_string and remove $link from function definition slashit($fruits, $dbLink); echo "<pre>"; print_r($fruits); echo "</pre>";
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $dbLink in /in/E1CZR on line 20 Warning: Undefined variable $link in /in/E1CZR on line 6 Fatal error: Uncaught Error: Call to undefined function mysql_real_escape_string() in /in/E1CZR:7 Stack trace: #0 /in/E1CZR(6): slashit(Array, NULL) #1 /in/E1CZR(20): slashit(Array, NULL) #2 {main} thrown in /in/E1CZR on line 7
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
56.58 ms | 401 KiB | 8 Q