Interpolating array element values in double-quoted strings : print « Utility Function « PHP






Interpolating array element values in double-quoted strings

 
<?
$meals['breakfast'] = 'A';
$meals['lunch'] = 'B';
$amounts = array(3, 6);

print "$meals[breakfast]";
print "$meals[lunch]. $amounts[0]";
print "$amounts[1].";
  
  








Related examples in the same category

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