Here's my code:
<?php
class vars
{
private static $javascript = null;
private static $style = null;
private static $content = array();
private static $dummy = 'dum';
public static function out ($var)
{
return self::$$var;
}
public static function in ($var, $value)
{
self::$$var = $value;
}
}
?>
echo vars:
ut('dummy'); //dum
vars::in('dummy2', 'qwerty');//Fatal error
echo vars:
ut('dummy2');
echo vars:
ut('dummy'); //dum
vars::in('dummy', 'qwerty');
echo vars:
ut('dummy');//qwerty
How should I create variable using function in(). Variable itself should only be available in this class.
Any ideas would be appreciated,
Martin
Colanth method doesn't work, obviously...
<?php
class vars
{
private static $javascript = null;
private static $style = null;
private static $content = array();
private static $dummy = 'dum';
public static function out ($var)
{
return self::$$var;
}
public static function in ($var, $value)
{
self::$$var = $value;
}
}
?>
echo vars:
vars::in('dummy2', 'qwerty');//Fatal error
echo vars:
echo vars:
vars::in('dummy', 'qwerty');
echo vars:
How should I create variable using function in(). Variable itself should only be available in this class.
Any ideas would be appreciated,
Martin
Colanth method doesn't work, obviously...