Embedded Conditionals : String Interpolation « String « PHP






Embedded Conditionals

 
<?php
    $value = 2;
    if($value > 0) {

        if($value <= 10) {

            echo 'The $value variable is between 1 and 10.';

        } else {

            if($value <= 20) {

                echo 'The $value variable is between 1 and 20.';

            } else {

                echo 'The $value variable is greater than 20';
            }

        }
    }

?>
  
  








Related examples in the same category

1.Adding "s" to the end of the variable name
2.Embed variables directly into strings
3.Embedding numbers and strings into other strings
4.Interpolating with curly braces