Answers for "global all vareable in php"

PHP
0

php set global variables from function

<?php 
function setGlobalVariable() {
    $GLOBALS['variable_name'] = "Some Value";
}
setGlobalVariable();
echo $variable_name;
// Outputs: Some Value
Posted by: Guest on September-10-2021
0

echo all php global variables

<?php
  // Returns all server global variables
  foreach ($_SERVER as $var => $value) {
    echo "$var => $value <br>";
  }
?>
Posted by: Guest on August-20-2021

Browse Popular Code Answers by Language