Welcome Guest, Not a member yet? Register   Sign In
GLOBAL variable
#16

[eluser]Unknown[/eluser]
Hi! i would like to ask if there is a workaround in CI in using global variable that we can call in a function and forgets the global var value after the page execution.
code below

<code>
$g_bar = '';

function do_x()
{
global $g_bar;

for( $i=0, $a=func_num_args(); $i<$a; $i++ ){
$args = func_get_arg($i);
$g_bar .= 'nice '. $args. '<br />';
}
}

....

do_x( 'a', 'b', 'c');
....
echo $g_bar;

</code>


i know i can compute the value in the controller. but this one i put in view.
your enlightenment is very much appreciated.


Messages In This Thread
GLOBAL variable - by El Forum - 08-28-2008, 02:18 PM
GLOBAL variable - by El Forum - 08-28-2008, 02:28 PM
GLOBAL variable - by El Forum - 08-28-2008, 02:40 PM
GLOBAL variable - by El Forum - 08-28-2008, 02:42 PM
GLOBAL variable - by El Forum - 08-28-2008, 02:43 PM
GLOBAL variable - by El Forum - 08-28-2008, 03:17 PM
GLOBAL variable - by El Forum - 08-28-2008, 03:22 PM
GLOBAL variable - by El Forum - 08-28-2008, 03:27 PM
GLOBAL variable - by El Forum - 08-28-2008, 03:32 PM
GLOBAL variable - by El Forum - 08-28-2008, 03:37 PM
GLOBAL variable - by El Forum - 08-28-2008, 03:48 PM
GLOBAL variable - by El Forum - 09-01-2008, 12:50 PM
GLOBAL variable - by El Forum - 09-01-2008, 03:37 PM
GLOBAL variable - by El Forum - 09-02-2008, 03:13 AM
GLOBAL variable - by El Forum - 09-02-2008, 01:13 PM
GLOBAL variable - by El Forum - 05-19-2010, 04:33 AM
GLOBAL variable - by El Forum - 07-12-2011, 03:23 PM
GLOBAL variable - by El Forum - 07-13-2011, 08:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB