[ create a new paste ] login | about

Link: http://codepad.org/5QD42xd1    [ raw code | output | fork ]

PHP, pasted on Dec 12:
<?php



   function stripSlashesRecursive($array) {
           $stripped = array();

           foreach($array as $key => $member) {

           if (is_array($member)) {
              $stripped[stripslashes($key)] = stripSlashesRecursive($member);

           } else {
               $stripped[stripslashes($key)] = stripslashes($member);
           }
       }

       return $stripped;
   }

    $globals = array('\b\ob', array('aw\esome' => 'y\eh'));

    $globals = stripSlashesRecursive($globals);

    var_dump($globals);


Output:
1
2
3
4
5
6
7
8
9
array(2) {
  [0]=>
  string(3) "bob"
  [1]=>
  array(1) {
    ["awesome"]=>
    string(3) "yeh"
  }
}


Create a new paste based on this one


Comments: