Page 1 of 1
What is this doing?
Posted: Thu Apr 07, 2011 8:04 am
by spacebiscuit
Can someone let me know what the following code is doing:
Code: Select all
start_on = new DateTime($start_on);
$this->end_on = new DateTime($end_on);
Thanks,
Rob.
Re: What is this doing?
Posted: Thu Apr 07, 2011 9:35 am
by social_experiment
It looks like objects are being instantiated
Re: What is this doing?
Posted: Thu Apr 07, 2011 9:39 am
by spacebiscuit
More specifically what does the '->' do/mean:
$this->end_on
Thanks,
Rob.
Re: What is this doing?
Posted: Thu Apr 07, 2011 10:16 am
by spacebiscuit
This is another example:
$sql is obviously a sql query
getInsertQuery is a function which I guess executes the query
but what is the purpose of:
Why not:
Re: What is this doing?
Posted: Thu Apr 07, 2011 11:25 am
by social_experiment
$this-> is the way to refer to the classes' methods / properties inside the class (or other classes extending it).
Will not work because you cannot refer to the method (getInsertQuery()) in that manner inside the class.
robburne wrote:$sql is obviously a sql query
It's actually a variable containing probably a value (or resource, depending on the function) returned by
getInsertQuery()