View Full Version : Change & to %26
09-09-2005, 03:11 PM
Hey I was wondering if there was a php function that changes symbols to numbers such as the & sign to %26. Thanks.
09-09-2005, 04:07 PM
$text = "The dog & I went home";
$text = str_replace("&","%26",$text);
// $text would now be The dog %26 I went home
09-09-2005, 04:27 PM
Sorry, I dont think I explained right. I want ALL symbols to be changed to that form. The thing is I dont know what its called, otherwise I could have looked it up. Here are some examples:
& = %26
@ = %40
# = %23
So basically what I want is if there is a symbol it should change to %something.
09-09-2005, 04:42 PM
urlencode() (http://www.php.net/urlencode) or rawurlencode() (http://www.php.net/rawurlencode) (preffered)
09-09-2005, 04:54 PM
Thankyou marek_mar, thats exactly what I wanted.
09-09-2005, 05:11 PM
thats exactly what I wanted.
I know :cool: .
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.