Tuesday, 19 July 2016

How to use variables in php code ?


For display variables using echo, always use variable in double quotes.

Example
<?php
    $text="Hello world";
    echo '<html><head><title>Title here</title></head><body>'; 

    echo '$text<br>';
    echo "$text<br>";
    echo '</body></html>';
?>


Output
$text
Hello world

No comments:

Post a Comment

Note: only a member of this blog may post a comment.