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; ?
beginner question
Moderator: General Moderators
-
shawngoldw
- Forum Contributor
- Posts: 212
- Joined: Mon Apr 05, 2010 3:38 pm
Re: beginner question
Inside of classes you need:
You need this for class variables, but not inside of the functions within a class.
Shawn
Code: Select all
var $a = 1;Shawn
-
shawngoldw
- Forum Contributor
- Posts: 212
- Joined: Mon Apr 05, 2010 3:38 pm
Re: beginner question
I use php5 and did not know that. Thanks for the tip!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.
beginner question
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
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