Beginner PHP Tutorial – 50 – String Functions: Replacing Part of a String



Facebook – https://www.facebook.com/TheNewBoston-464114846956315/
GitHub – https://github.com/buckyroberts
Google+ – https://plus.google.com/+BuckyRoberts
LinkedIn – https://www.linkedin.com/in/buckyroberts
reddit – https://www.reddit.com/r/thenewboston/
Support – https://www.patreon.com/thenewboston
thenewboston – https://thenewboston.com/
Twitter – https://twitter.com/bucky_roberts

source

34 comments

  1. very good but i think you will now repeat it again and again to keep that in mind … which will take time … which means it isn't so good

  2. I am overwhelmed. so many options to search string, replace string, cut string, divide string. almost starting to mix them up πŸ™ ……does php mostly deal with string πŸ™

  3. CHEAK MY CODE OUT REALLY AMAZING
    <?php
    $start = 0;
    $want_to_replace = "javascript";
    $from = "Php";
    $length = strlen($want_to_replace);
    $string = "This is php. I am learning Php";
    $position = strpos($string , $from , $start);
    $output = substr_replace($string , $want_to_replace , $position , $length);

    echo $output;
    ?>

  4. we can even use strpos to find the start of the word, actually its better then counting the position of the word to be replaced, it goes as follows:$string_new=substr_replace($string,'part',strpos($string,'Alex',16),4);

Comments are closed.