Like the title says: Is PHP an object oriented programing language like Java? and how similar is to Java? Also what is the best code editor for PHP and is there a GUI builder for PHP? I have taken 3 years of programming courses(2 years of Java + 1 year Visual Basic).
PHP is object oriented. You can create classes. In my opinion it is slightly similar to Java. PHP is based on C. In my opinion, PHP is easier than Java. As for code editors, I have never used one. I write text files and upload them to a test server for testing. A code editor will use emulation. I find it easier to upload to the server and see a real-time example with the server php settings that will be used.
I have just to agree with CTThompson. PHP is an OO language. Using PHP 5.3 (beta) , you'll have extra namespace support. PHP OO is more like C++ than like Java. PHP can be mix with procedural and OO . There's a lot of editor you can use. Aptana (eclipse based), Netbeans for PHP or an simple plain PSPAD is also recommended. You can find a few paid based editor like Zend, Comodo.
Yes. Its OOP Use Adobe Dreamweaver CS4 for editor Very similar to Java in OOP but not in building UI,php uses html. Same client-server relation.
PHP isn't object oriented, it has bolted on support for objects and namespaces. To get into teritory familiar to you from a Java perspecitve you're going to have to start out using one of the common frameworks like Symphony, Zend, or cake. Comming from Java you're probably familiar with Eclipse, I believe you can use that for PHP as well.
php5 is not full oop. php is not designed for gui, it's designed for cli and browser output. If you really need gui, use php-gtk.
It is true that PHP is not a truly Object-Oriented Language, basic object-oriented programming functionality was added in PHP 3 and from then on its improving a lot current version PHP 5.3(beta) has more objects and namespaces support. It is somewhat similar to Java except syntax. If your planning to learn then I advice you not to use any editors, instead use a text editor for your coding, that will help you a lot in understanding and learning a programming language better. Editors or UI builders for any programming languages use code emulations and most of the coding is taken care by them. So, as a learning perspective use a text editor and then you can switch to any UI builders or Editors. Regards, Gonzo
PHP is an object oriented language, it uses functions, classes, includes Its syntax is similar to java and C++ You can create function and classes in separate files and then you can call these functions and classes and call in any page after include this file. In php you can also include text files as well as any extension as you want You dont need specific editor for this, you can all php work in Dreamweaver. It better support php
Thanks everyone for your responses, I really appreciate the help. I am happy to hear that you can create object and classes in php . I have been using eclipse to create my java programs so I will just use it for my php programs.
Indeed, php is quite powerful once you dive in, I love it, its one of those languages that you can use at almost any skill level.
Java is not so much like PHP. The basic OOP capabilities is really all they have in common. For starters, PHP is parsed by the web server with no client-side needs to process properly. However, this can be more limited seeing as it is for site functionality and not applets, etc. If you have any knowledge of C++ you'll be in great shape though. PHP is a down-scaled C++ for the web. (In simple terms) The include functions are there the major difference is since PHP is a web language, you don't define variables by type. (E.g.: int, char, float, long int, etc.) Instead, you'll be preceding the variables with a dollar sign ($). Also, you're # will comment instead of #include "header_file.h" or something. Basic syntax, however, follows the exact pattern in both C++ and PHP. Regards, Dennis M.
Hello everyone here, how some guys are saying that PHP is not a OOP ? What I should say officially ? Yes or no!
PHP is flexible, if you want it oop, then it is. If you want it procedural, then it is too. IT is BOTH.
PHP is an object oriented programming language. Class Pet { } Class Dog extends Pet { } $pet = new Dog(); // I created an OBJECT! PHP: Is it a great object oriented language now that is up for debate. Of course there is no perfect OO language no one agrees. C++ you can inherit from multiple classes. While Java you cannot (you can do implements but not the same). So PHP's issue is with so many beginners they could be using objects for no reason at all just because a tutorial said to. The same could be said about other languages to of course. It's just PHP is a lot easier to pickup than a lot of other languages so you see it more often.
Even C++ is not pure object oriented language if you wana know whats OOPS design start reading Design Patterns. And no PHP is not pure object oriented making classes and functions dosent make language OOP.
The fundamentals in defining an OOP are: Class - php supports classes Object - "pattern of a class" - yes Instance - yes Method - yes (aka "function") Message passing - yes. 1 object can invoke another objects methods. Inheritance - php supports inheritance after v5 (i think). "class User extends Person" Abstraction - yes. 1 class can have other classes as types, without the instantiating code needing to know about the other classes the top level class uses. E.g. for the "user" class mentioned above, code the instantiates User doesnt need to know about the class "Person" as person would be handled internally to "user". Encapsulation - methods or fields can be encapsulated in php, by the use of "private" "protected" and "public" keywords. "private static $name; public function getName() {}" Polymorphism - yes - this is also known as overriding and overloading. a person class may have a method called "sendMessage". "user" class may override this method to perform different tasks, while a "student" class that also extends "person" may perform totally different code. Both student and user call the same method that is defined in person, but may have different results. Decoupling - yes. loosely, this is the reuse of code. for example, a person class may initialise certain variables. you could then use the default constructor of sub-classes (user / student) to call methods in the superclass. e.g. in student: function __construct() { $this->person = new Person(); } The function __construct in person may then may call "session_start" set a variable is_real to true and some other functions. More info on these concepts can be found on wikipedia. So based on these programming concepts, PHP is OOP.
Hi I have come across this article which explains that PHP is not purely an OO language. http://www.hiteshagrawal.com/php/php5-tutorial-not-pure-object-oriented-programming-approach Anyone second me?