plese sovle sum global keyword... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

plese sovle sum global keyword...

hi i solving addation(+) problem sum using global keyword but showing error plese solve sum.... sorce code below... <?php $g= 2; $d= 1.2; function get() { global$g + global$d; echo $g .$d; } get(); ?> and see u geting output which datatype. it showing error plese help me and post true method i waiting for replay

30th Aug 2016, 4:43 AM
vinay
vinay - avatar
1 Answer
+ 1
your syntax is wrong. i show you. its right. <!DOCTYPE html> <html> <body> <?php $x = 75; $y = 25; function addition() { $GLOBALS['z'] = $GLOBALS['x'] + $GLOBALS['y']; } addition(); echo $z; ?> </body> </html>
31st Aug 2016, 10:08 PM
HawkEye
HawkEye - avatar