Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,894 questions

51,825 answers

573 users

How to strip backslashes from an array of strings in PHP

1 Answer

0 votes
function stripslashes_in_array($arr)
{
    $arr = is_array($arr) ?
                array_map('stripslashes_in_array', $arr) :
                stripslashes($arr);

    return $arr;
}

$array = array("a\\bc", "x\\'pix", array("we\\wa", "x\\'pos"));
$array = stripslashes_in_array($array);

print_r($array);


/*
run:
    
Array ( [0] => abc [1] => x'pix [2] => Array ( [0] => wewa [1] => x'pos ) ) 
    
*/

 



answered Jul 20, 2016 by avibootz

Related questions

1 answer 204 views
1 answer 125 views
1 answer 87 views
1 answer 167 views
2 answers 247 views
3 answers 231 views
...