Skip to content

Instantly share code, notes, and snippets.

@hellofromtonya
Last active February 1, 2017 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hellofromtonya/51f2c8027d371e155901d359a6a0064f to your computer and use it in GitHub Desktop.
Save hellofromtonya/51f2c8027d371e155901d359a6a0064f to your computer and use it in GitHub Desktop.
Scope
<?php
$global_variable = 'I am a global variable';
d( $global_variable );
function test_scope( $local_variable ) {
$local_variable .= ' I am only accessible to my function!';
echo '========= in the test_scope function ========';
d( $local_variable );
d( $global_variable );
}
//test_scope( 'testing from global space' );
d( $local_variable );
ddd( $global_variable );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment