Use single quotes to print the variable name, not the value in PHP

Description

The following code shows how to use single quotes to print the variable name, not the value.

Example


/*  w  w  w. ja va2s.co  m*/
<?php
    $color = "red";
    echo "Roses are $color";
    echo "<br>";
    echo 'Roses are $color';
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Development »




Environment
Error
Hash
Include
Locale
Math
Network
Output
Reflection
PHP Regular Expressions