PHP Learning : Global - Publik Talk

Breaking

An informative website for every one.

Post Top Ad

Post Top Ad

Wednesday, August 2, 2017

PHP Learning : Global

Description:

Global scope refers to any variable that is defined outside of any function Any part of a script that is not inside a function..
Variable from within a function,use the Global keyword.

Code:

<?php

$a=5;

$b=10;

function myTest()

{

global $a,$b;

$b=$a+$b;

}

myTest();

echo $b;

?>


Output:


No comments:

Post a Comment

Post Top Ad