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 3 of 3
  1. #1
    Regular Coder
    Join Date
    Dec 2006
    Posts
    306
    Thanks
    24
    Thanked 0 Times in 0 Posts

    add % to a string

    Hi;
    how i can add the '%' to a string ?

    for example

    astring=6789000 ---> %6%7%8%9%0%0%0%
    bstring=98765--->%9%8%7%6%5%

    my code as following, it doesn't work

    PHP Code:
    <?php
      $check
    ="98888778";
      echo 
    str_ireplace('%','',$check);

    ?>

  • #2
    Senior Coder kbluhm's Avatar
    Join Date
    Apr 2007
    Location
    Philadelphia, PA, USA
    Posts
    1,509
    Thanks
    3
    Thanked 258 Times in 254 Posts
    PHP Code:
    $check str_split$check);
    $check '%' implode'%'$check ) . '%'

  • Users who have thanked kbluhm for this post:

    kamkam (04-03-2010)

  • #3
    Regular Coder
    Join Date
    Dec 2006
    Posts
    306
    Thanks
    24
    Thanked 0 Times in 0 Posts
    wonderfull, thanks a lot


  •  

    Posting Permissions

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