Jump to content

Recommended Posts

Posted

Hi Stefan,

 

Found you in Google. Great! Learning OOP here ! (and having 5 years of PHP experience the old way;)

 

I thought "well this is going well" after wathing the first 4 OOP video's

 

www.killerphp.com/tutorials/object-oriented-php

 

and than..... I lost you in video 5 when you wrote:

 

$stefan = new person();

 

I am confused about $stefan because you also made the var $name = "Stefan";

 

I mean... if you would do:

 

$nicole = new person();

 

(in THAT example)

 

it would still echo Stefan as a result in your example (build objects in PHP part 2 of 3).

 

So why do you give the variable in the index file the name $stefan and not $foo or $too or $whatever ? You use a real persons name for a variable and I think that would never happen in a real script.

 

I did notice, after downloading the Source Files, you changed

 

var $name = "Stefan"; (see video at 06:03)

 

to

 

var $name;

 

Hope you get my confusion.

 

Regards,

 

Arno

Posted

No one has responded to this yet, so thought I'd leave a quick comment...

 

In regards to "$stefan = new person();" that's just what he happened to name the variable. There's no exact reason for using a person's name, and yes, using a more general name like $name or something similar would make more sense. The exact variable name doesn't change the value that it holds.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...