Adding "s" to the end of the variable name : String Interpolation « String « PHP






Adding "s" to the end of the variable name

 
<?php
            $food = "grapefruit";
            print "These ${food}s aren't ripe yet.";
            print "These {$food}s aren't ripe yet.";
    ?>
  
  








Related examples in the same category

1.Embed variables directly into strings
2.Embedded Conditionals
3.Embedding numbers and strings into other strings
4.Interpolating with curly braces