0

Global verabalie

<?php $name = array('Venkatesh', 'Vijay', 'Vikram'); function myname() { $GLOBALS[z] = $GLOBALS['$name[0]'] + $GLOBALS['$name[1]']; } myname(); echo $z; ?> This sum is showing is error plese tell me why showing error ?

22nd Sep 2016, 7:32 AM
vinay
vinay - avatar
1 Answer
0
You made a mistake Vebkatesh+Vijay=StarWares :) try this $name = array('15', '93', '47'); function myname() { $GLOBALS[z] = $GLOBALS['$name[0]'] + $GLOBALS['$name[1]']; } myname(); echo $z; Output will be 15+93=108
28th Sep 2016, 2:05 PM
Driss Baidou
Driss Baidou - avatar