Professional Web Applications Themes

How can I change ? to %3F - PHP Development

Is it possible to change the ?, :, & and / characters to their respective hex(?) values automatically? That is without having to use str_replace for each one? Anyone know how? Chris...

  1. #1

    Default How can I change ? to %3F

    Is it possible to change the ?, :, & and / characters to their respective
    hex(?) values automatically? That is without having to use str_replace for
    each one? Anyone know how?

    Chris

    Cditty Guest

  2. #2

    Default Re: [PHP] How can I change ? to %3F

    Hello,

    This is a reply to an e-mail that you wrote on Tue, 5 Aug 2003 at
    23:16, lines prefixed by '>' were originally written by you.
    > Is it possible to change the ?, :, & and / characters to their
    > respective
    > hex(?) values automatically? That is without having to use
    > str_replace for
    > each one? Anyone know how?
    > Chris
    [url]http://uk2.php.net/urlencode[/url]

    If you want *only* the ?:&/ characters changed then it can be done
    with a regular rexpression, the e modifier, and the ord(), hex() and
    strtoupper() functions, post back if you would like an example.

    HTH

    David.

    --
    phpmachine :: The quick and easy to use service providing you with
    professionally developed PHP scripts :: [url]http://www.phpmachine.com/[/url]
    Free PHP error handling script: [url]www.phpmachine.com/error-handler/[/url]

    Professional Web Development by David Nicholson
    [url]http://www.djnicholson.com/[/url]

    QuizSender.com - How well do your friends actually know you?
    [url]http://www.quizsender.com/[/url]
    David Nicholson Guest

  3. #3

    Default Re: [PHP] How can I change ? to %3F

    DUH

    Thanks all. This is exactly what I was looking for. Couldn't remember the
    exact term of the chars though. Thanks again.

    Chris

    At 05:19 PM 8/5/2003, David Nicholson wrote:
    >Hello,
    >
    >This is a reply to an e-mail that you wrote on Tue, 5 Aug 2003 at
    >23:16, lines prefixed by '>' were originally written by you.
    >
    > > Is it possible to change the ?, :, & and / characters to their
    > > respective
    > > hex(?) values automatically? That is without having to use
    > > str_replace for
    > > each one? Anyone know how?
    > > Chris
    >
    >[url]http://uk2.php.net/urlencode[/url]
    >
    >If you want *only* the ?:&/ characters changed then it can be done
    >with a regular rexpression, the e modifier, and the ord(), hex() and
    >strtoupper() functions, post back if you would like an example.
    >
    >HTH
    >
    >David.
    >
    >--
    >phpmachine :: The quick and easy to use service providing you with
    >professionally developed PHP scripts :: [url]http://www.phpmachine.com/[/url]
    >Free PHP error handling script: [url]www.phpmachine.com/error-handler/[/url]
    >
    > Professional Web Development by David Nicholson
    > [url]http://www.djnicholson.com/[/url]
    >
    > QuizSender.com - How well do your friends actually know you?
    > [url]http://www.quizsender.com/[/url]
    Cditty Guest

  4. #4

    Default Re: [PHP] How can I change ? to %3F

    David Nicholson wrote:
    > If you want *only* the ?:&/ characters changed then it can be done
    > with a regular rexpression, the e modifier, and the ord(), hex() and
    > strtoupper() functions, post back if you would like an example.
    $new_str =
    str_replace(array('?',':','&','/'),array('3F','3A','26','2F'),$old_string);

    should be less costly than a regular expression with an 'e' modifier.

    --
    ---John Holmes...

    Amazon Wishlist: [url]www.amazon.com/o/registry/3BEXC84AB3A5E/[/url]

    PHP|Architect: A magazine for PHP Professionals [url]www.phparch.com[/url]




    John W. Holmes Guest

Similar Threads

  1. Replies: 0
    Last Post: August 15th, 10:02 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139