Created
January 2, 2017 23:09
-
-
Save ilhamarrouf/290100109cbce6a21caa75c388d0779e to your computer and use it in GitHub Desktop.
PHP Function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$a = 2; | |
$b = 16; | |
// Cara 1 | |
function cara1() { | |
global $a, $b; | |
$c = $a + $b; | |
return $c; | |
} | |
echo cara1(); | |
echo "<br>"; | |
// Cara 2 | |
function cara2() { | |
$c = $GLOBALS['a'] + $GLOBALS['b']; | |
return $c; | |
} | |
echo cara2(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment