note 14098 added to function.addslashes.php

From: Date: Tue, 17 Jul 2001 14:59:03 +0000
Subject: note 14098 added to function.addslashes.php
Groups: php.notes 
Request: Send a blank email to php-notes+get-15486@lists.php.net to get a copy of this message
_JAVA-SCRIPT_ has no precast possibility to get rid off added slashes (as far as I know). I wrote this function to fix this little deficit: function stripslashes (arbstrg) { if (typeof arbstrg != 'string') return arbstrg; if (arbstrg.length > 1) { for(qqq=arbstrg.length-2; qqq>=0; qqq--) { if (arbstrg.substring(qqq,qqq+1) == "\\") { hlpchr = arbstrg.substring(qqq+1,qqq+2); if ((hlpchr == "\'") || (hlpchr == "\"") || (hlpchr == "\\")) { helpstrg = arbstrg.substring(qqq+1,arbstrg.length); arbstrg = arbstrg.substring(0,qqq); arbstrg = arbstrg+helpstrg; } } } } return arbstrg; } hope it'll help some people ... http://www.php.net/manual/en/function.addslashes.php

« previous php.notes (#15486) next »