How To Remove Backslashes From URL In PHP

Web Developer Kaustubh
1 min readOct 1, 2019

--

Problem:-

Sometime URL has unnecessary backslashes which gives error.

Solution:-

For removing backslashes stripslashes() string function is used in PHP.It removes backslashes in a string.

Syntax:-

stripslashes(string);

Example:-

URL:-

https:\/\/kaustubh\/remove\/shashes.php

Required Output:-

https://kaustubh/remove/shashes.php

Code:-

<?php

$a=”https:\/\/kaustubh\/remove\/shashes.php”;

echo stripslashes($a);

?>

Output:-

https://kaustubh/remove/shashes.php

--

--

Web Developer Kaustubh
Web Developer Kaustubh

Written by Web Developer Kaustubh

Sr.Web developer. love to code. PHP , Javascript, Mysql, Laravel, Jquey, git, project planing,Linux

No responses yet