A look at PHP

Okay, on Sunday I went over a list of possible programming languages to learn. It ended with me decided to learn all of them, but unsure as to what to learn first. I decided to go over each of them and figure out what I thought about them. How would I do this? What I have decided to do is see how complex it is to do the same thing in each language. What better to test out a language than to create a class?
Yesterday, I went over the Python implementation. Today is PHP’s turn.

PHP Class

< ?php
class Person {
	private $firstName;
	private $lastName;
	private $age;

	public function __construct($firstName, $lastName, $age){
		$this->firstName = $firstName;
		$this->lastName = $lastName;
		$this->age = $age;
	}
	public function IntroduceYourself(){
		return "Hello, my name is $this->firstName $this->lastName, and I am $this->age year(s) old.";
	}
}

?>

PHP Implementation

< ?php
$dan = new Person("Dan", "Appleyard", 27);
echo $dan->IntroduceYourself();
?>

My Thoughts

I’ve had some minor experience with PHP before in the past. Nothing really to write home about. PHP is fine I guess, reminds me too much of C and C++ for some reason. I’m really looking for a language that I can do both in and out a web environment. PHP is just web. As of now, PHP is slighly over Perl and under Python. Tomorrow I will go over Ruby.

This entry was posted in Development, Learning, PHP and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>