Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: Change & to %26

  1. #1
    New Coder
    Join Date
    Sep 2005
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Change & to %26

    Hey I was wondering if there was a php function that changes symbols to numbers such as the & sign to %26. Thanks.

  • #2
    New Coder
    Join Date
    Jul 2005
    Location
    Perth, Australia. Age: 13
    Posts
    81
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes str_replace()
    For example,
    $text = "The dog & I went home";
    $text = str_replace("&","%26",$text);
    // $text would now be The dog %26 I went home

    http://www.php.net/str_replace
    I lost my signature, have you seen it?
    I have the power to erase you...

  • #3
    New Coder
    Join Date
    Sep 2005
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #4
    Senior Coder
    Join Date
    Aug 2003
    Location
    One step ahead of you.
    Posts
    2,815
    Thanks
    0
    Thanked 3 Times in 3 Posts
    urlencode() or rawurlencode() (preffered)
    I'm not sure if this was any help, but I hope it didn't make you stupider.

    Experience is something you get just after you really need it.
    PHP Installation Guide Feedback welcome.

  • #5
    New Coder
    Join Date
    Sep 2005
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thankyou marek_mar, thats exactly what I wanted.

  • #6
    Senior Coder
    Join Date
    Aug 2003
    Location
    One step ahead of you.
    Posts
    2,815
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Quote Originally Posted by NumBa1Stunna516
    thats exactly what I wanted.
    I know .
    I'm not sure if this was any help, but I hope it didn't make you stupider.

    Experience is something you get just after you really need it.
    PHP Installation Guide Feedback welcome.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •