Page 1 of 1
Dought
Posted: Wed Sep 05, 2007 1:38 am
by myharshdesigner
When we use this
so why should we use this :-
?
any good tutorial for
icon.
Posted: Wed Sep 05, 2007 1:48 am
by anjanesh
designer ? Its going to be really tough to get hang of
OOP concepts if you're not in the hang of programming.
I would suggest you start with C++ or C# and then get back to PHP because C++ and C# are strictly OOP and not
loosely type like PHP and Python which makes it easier to fall back to procedural style if you cant come up with an OOP solution.
Posted: Wed Sep 05, 2007 3:12 am
by myharshdesigner
anjanesh wrote:designer ? Its going to be really tough to get hang of
OOP concepts if you're not in the hang of programming.
I would suggest you start with C++ or C# and then get back to PHP because C++ and C# are strictly OOP and not
loosely type like PHP and Python which makes it easier to fall back to procedural style if you cant come up with an OOP solution.
sir i know -> this means pointing something. but can u explane me in details pl
Posted: Wed Sep 05, 2007 6:01 am
by anjanesh
Posted: Wed Sep 05, 2007 8:15 am
by superdezign
anjanesh wrote:C++ and C# are strictly OOP
Not true at all. Java is strictly OOP. C++ is just like PHP in the sense that you can program with or without objects.
The PHP Manual is the best place to understand the syntax. The first few chapters teach you the basics of the language, but they do assume that you are already familiar with other programming languages. I agree with anjanesh in that making PHP your first language doesn't make it easy to understand all of the concepts, because PHP doesn't not support it all. It is still growing.
Posted: Wed Sep 05, 2007 10:17 am
by anjanesh
The problem with learning OOP concepts straight from PHP is because of the differences between PHP4's OOP model and PHP5's OOP model. It definitely would confuse others.
Posted: Wed Sep 05, 2007 11:37 am
by hawleyjr
anjanesh wrote:I would suggest you start with C++ or C# and then get back to PHP because C++ and C# are strictly OOP and not
loosely type like PHP and Python which makes it easier to fall back to procedural style if you cant come up with an OOP solution.
I disagree, If you are just trying to play around with PHP and OOP messing around (Or learning) via PHP is not a bad thing.
...oh, and to answer your question...
Code: Select all
<?php
class Foo{
var $xyz;
function Foo(){
$this->xyz = 'blah';
}
function getXYZ(){
return $this->xyz;
}
}
$myObj = new Foo();
echo $myObj->getXYZ();
echo '<br />';
echo $myObj->xyz;
?>
Would output:
blah
blah
Posted: Wed Sep 05, 2007 11:41 am
by Christopher
anjanesh wrote:The problem with learning OOP concepts straight from PHP is because of the differences between PHP4's OOP model and PHP5's OOP model. It definitely would confuse others.
PHP4 and PHP5 are essentially the same. Certainly use of '->' is identical in both -- it references a function or property in an instantiated object.