websmentor.com websmentor.com - 1 month ago 9
PHP Question

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

Answer

Use this

$userheightfeet1 = $_POST["userheightfeet"];

echo stripslashes($userheightfeet1);

Also you may use

$userheightfeet1 = $_POST["userheightfeet"];

echo str_replace('\','', $userheightfeet1);