Page 4 of 4 FirstFirst ... 234
Results 31 to 31 of 31

Thread: safe users commenting

  1. #31
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default

    I suspect that at some point this thread should have been split.

    I am not sure what problem you are referring to with this statement:
    maybe, because i used this a lot:
    $tag = str_replace('*', '/*', $tag);
    but the following is valid.
    PHP Code:
    $tag str_replace('*''/*'$tag); 
    There are two ways to go about what you are trying to do.

    Notice in this example here I am using double quotes to encase a single quote. This works, but is not a good idea.
    Code:
    <?php
    $tag=".,'*@";
    $tag = str_replace("'", "/'", $tag);
    echo"$tag";
    ?>
    The following is better. Here I am "escaping" the quote. This means I am using a backslash "\" right before the quote so that it will be recognized as a quote as opposed to an end of a string.

    Code:
    <?php
    $tag=".,'*@";
    $tag = str_replace('\'', '/\'', $tag);
    echo"$tag";
    ?>
    Just for fun
    Code:
    <?php
    echo "pp &quot; pp";
    ?>
    For a list of some other charcters and symbols you can create try this link http://www.nouilles.info/keyboard_shortcuts.html These are just html character code shortcuts. There are a potential 65536 different characters that can be created, mostly by using numerical notation as opposed to html character codes, but maybe you get the idea. There is some small variation as opposed to which ones are recognized and which are not depending on the browser used.
    Last edited by james438; 11-21-2009 at 02:52 AM.
    To choose the lesser of two evils is still to choose evil. My personal site

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
  •