Mix variable with string output : print « Utility Function « PHP

Mix variable with string output

    $cars = 10; 
    print "We have $cars cars.\n<br>"; 
    print "We got another new car.\n<br>"; 
    print "Now we have $cars cars!\n<p>"; 
    print '<b>$cars++</b> is the same to PHP as <b>$cars + 1.</b>'; 

Related examples in the same category

1.Code Block Containing Multiple print() Statements
2.Interpolating array element values in double-quoted strings
3.Interpolating array element values with curly braces
4.Using parentheses with these constructs
5.Mix the output of date( ) with a text string to get a natural-looking statement
6.Output string value
7.Output value of a variable wit print function
8.Printing a form