the global statement is used : Global « Language Basics « PHP






the global statement is used


<?php
  $ilike = "Rock";
  function music (){
      global $ilike;
      echo "I love listening to $ilike music!", "\n";
  }
  music ();
?>

           
       








Related examples in the same category

1.Accessing Global Variables with the global Statement
2.Using the global Statement to Remember the Value of a Variable Between Function Calls