Advertisement
shaashwato1308

PHP - function - add_escape_before_single_quote($str)

Dec 9th, 2014
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.35 KB | None | 0 0
  1. function add_escape_before_single_quote($str){
  2.     //$str = "Sha'ash'wato";
  3.     $str_len = strlen($str);
  4.     $str_temp = "";
  5.     for($c = 0; $c < $str_len; $c++){
  6.         if($str[$c] == "'"){
  7.             $str_temp .= "\'";
  8.         }else{
  9.             $str_temp = $str_temp.$str[$c];
  10.         }
  11.     }
  12.     // echo $str_temp;
  13.     return $str_temp;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement