php4 scope
- Started
- Last post
- 6 Responses
- System-Idle
this is driving me mad :/
cant seem to ref vars inside class
tried $this-> and parent::
also info on php.net is unclear,
any help would be greatly app
eg code:
class Scope
{
var $myVar1 = NULL;function Scope()
{
$myVar1 = 'var 1';
//echo 'Scope';
//echo $myVar1;
}function one()
{
echo 'var: '.$myVar1;
}}
$s=new Scope();
$s->one();
- PuFFi0
php5 only no ?
class Scope
{
private $myVar1 = NULL;function Scope()
{
$this->myVar1 = 'var 1';
//echo 'Scope';
//echo $myVar1;
}function one()
{
echo 'var: '.$this->myVar1;
}}
$s=new Scope();
- System-Idle0
I am restricted to v4 on host server.
it says on php.net that this is possible in 4.
do you have any sugg, as how to emulate otherwise?
- PuFFi0
sorry no idea, i'll ask around.
good luck
- PuFFi0
you can try it on a local machine with wamp server
http://www.wampserver.com/en/dow…
- System-Idle0
thanks PuFFi...
anyone else have some sugg?
- System-Idle0
Dang!! sust it!
note var assignment and var access is minus '$'
the hours I have wasted...
class Scope
{
var $myVar1 = NULL;function Scope()
{
$this->myVar1 = 'var 1';
//echo 'Scope';
//echo $myVar1;}
function one()
{
echo 'var: '.$this->myVar1;
}}
$s=new Scope();
$s->one();
back to it :)