简体   繁体   中英

Remove forward slash using php

I want to remove forward slash from below mentioned string using php

Output

$userheightfeet1 = $_POST["userheightfeet"];

5\'10

Expected O/P

  5'10

Use this

$userheightfeet1 = $_POST["userheightfeet"];

echo stripslashes($userheightfeet1);

Also you may use

$userheightfeet1 = $_POST["userheightfeet"];

echo str_replace('\','', $userheightfeet1);
<?php
$str = "5\'10";

// 5'10
echo stripslashes($str);
?

Hope this helps!! :)

I have used give code it will help you :-

 $str="5\'10";
 $str=stripslashes($str);
 echo $str;

Use function

    str_replace(find,replace,string,count)

http://www.w3schools.com/php/func_string_str_replace.asp

Replace what ever character you want to replace with "".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM