Page 1 of 1

beginner question

Posted: Tue Aug 17, 2010 5:34 pm
by aabvg
code :
<?php
class A {
$a=1;
function Aa ( ) {
echo " Aa cal l" ; }

}
$A = new A;
$A-> Aa();
$A-> $a;
?>
display notice :
Parse error: parse error, expecting `T_FUNCTION' in C:\Program Files\EasyPHP5.3.0\www\moji sajtovi\proba vezbe.php on line 3

what is wrong with $a=1; ?

Re: beginner question

Posted: Tue Aug 17, 2010 5:42 pm
by shawngoldw
Inside of classes you need:

Code: Select all

var $a = 1;
You need this for class variables, but not inside of the functions within a class.


Shawn

Re: beginner question

Posted: Wed Aug 18, 2010 6:40 am
by aabvg
thanx shown

Re: beginner question

Posted: Wed Aug 18, 2010 10:57 am
by shawngoldw
denovank wrote:var is for php 4 I would say it's deprecated. If you learn php5, go with public, private... in replacement for better variable scope.
I use php5 and did not know that. Thanks for the tip!

beginner question

Posted: Thu Aug 19, 2010 3:53 am
by Vethalam
Hi Guys Im in New In PHP, Xampp...I want to learn and develop in php...
I know little HTML, JS,JavaScript,Java

Now i install XAMPP...
But i dont know how to start....

i want design a simple form
dont know start where,how,which....

Pls Just give a intro........i will pckup.......

Thanks in advance