How to prepend a string in PHP?

How to prepend a string in PHP?

Asked on November 1, 2018 in PHP.
Add Comment


  • 1 Answer(s)

        Here the PHP Concatenation Operator is used.
    There is no specific function to prepend a string in PHP. But the PHP is used concatenation operator (.) to prepened a string with another string.

    For example:

    <?php
    $a = "Hello";
    $b = "World!";
    $b = $a . " " . $b;
    echo $b; // Outputs: Hello World!
    ?>
    

     

    Answered on November 1, 2018.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.