NYCPHP Meetup

NYPHP.org

[nycphp-talk] global variables

Chris Snyder chris at psydeshow.org
Thu May 22 13:35:47 EDT 2003


You can just declare $var1 as a global with global $var1; inside your 
first function. You don't need to pass it around using the $_GET array.

Try this:

<?php
function myfunction() {
    global $var1;
    $var1= "Hello world";
}

function mynextfunction() {
    global $var1;
    print $var1;
}

myfunction();
mynextfunction();
print " -- (^_^)P ";
?>




More information about the talk mailing list