Reputation: 869
I have a string like
https:\/\/scontent.xx.fbcdn.net\/hphotos-xta1\/v\/t1.0-9\/p50x50\/11139440_1010664825611559_1305796970308877058_n.jpg?oh=6da07776dd8ba8270c2c32de2957b7d3&oe=560D0AF0
I want to replace all "\" with preg_replace function to be like this
https://scontent.xx.fbcdn.net/hphotos-xta1/v/t1.0-9/p50x50/11139440_1010664825611559_1305796970308877058_n.jpg?oh=6da07776dd8ba8270c2c32de2957b7d3&oe=560D0AF0
Examples:
How do I achieve this ?
Upvotes: 0
Views: 200
Reputation: 3777
Why use either, when stripslashes() will do this for you:
result:
https://scontent.xx.fbcdn.net/hphotos-xta1/v/t1.0-9/p50x50/11139440_1010664825611559_1305796970308877058_n.jpg?oh=6da07776dd8ba8270c2c32de2957b7d3&oe=560D0AF0
example
<?php
$string = 'https:\/\/scontent.xx.fbcdn.net\/hphotos-xta1\/v\/t1.0-9\/p50x50\/11139440_1010664825611559_1305796970308877058_n.jpg?oh=6da07776dd8ba8270c2c32de2957b7d3&oe=560D0AF0';
echo stripslashes($string);
Upvotes: 1