Page 1 of 1

function in class question

Posted: Wed Mar 19, 2003 8:49 am
by Guy
how can i call a function of a class from the class when i didnt do new to the class
exapmle:

Code: Select all

class A
{
	f1()
	{
		echo 3;
	}
	
	f2()
	{
		A::f1();    	 //doesn't work
		$this->f1();	//doesn't work
			
	}		
	
}

A::f2();
Thanks
Guy

Posted: Wed Mar 19, 2003 5:25 pm
by volka
you forgot "function":arrow: parse error

Code: Select all

<?php
class A
{
   function f1()
   {
      echo '3';
   }
   
   function f2()
   {
      A::f1();
   }      
}

A::f2();
?>