I will carry you back again to another video lecture in PHP.
And in this video lecture I warhead and tissue about object functions in PHP.
All right.
So in PHP we have what's called object functions.
And these are functions that are used by objects to perform some specific tasks.
In PHP now we have this value function which we create.
Here is a constructor function.
And the object function is go ahead and go down here.
So we have learnt about classes and objects and we have done something num constructions.
Then let's go ahead and look at object functions.
So go right in here and create a function.
And what is this function to determine about this car here to know a car is updated.
So any car that is above 2 or 2000 or which is updated above 2000 is still current, but any car that
is characters below 2000 is outdated.
So I will first of all change the genes in the son to be like a 1997 model.
So if you are driving 1997 model, that means you are driving an outdated car.
All right, so this function, we have to determine which of the cars that is outdated.
If it is updated it's going to be true or false.
Let's go ahead and determine that it's here.
This function is done.
Go ahead and say outdated.
So it does try to use this function to check the current cars and the the the test cars.
That is the aim of this program.
Now let's go ahead and create this function because we have to learn how to use this functions to work
with our objects.
That's why object functions are very important to learn, because it doesn't stop in creating constructors
and classes.
You also going to add some things and use that.
So the more you create more functions.
Here you're creating objects.
Functions.
Now let's go ahead and see if.
And then you go ahead and specify the current object you're talking about.
So if this.
So let me go ahead and remove one of these.
So if this and we're going to use the E the variable we're going to talk about is the e.
So if this year and that is very important it's a equal or that is greater than or equal to then go
ahead and shift this because everything is together.
Now let's go ahead and say is equal to 2000.
So any one of these are from 2000 and above.
That's why I included 2000 okay.
So if this is the year is greater than or equal to 2000 then is correct and return false.
So that's any correct is above 2000 is not updated, but if the car is a below 2000, it will go above
and I go ahead and return.
True because we are more interested in outdated and not outdated.
Now if we go ahead and use this return false and a true this abhorrence and there might be an error
because sometimes the boolean you would return false when it is true.
So let's go ahead and make this.
So don't confuse.
And let's go ahead and make this to be string.
Let's go ahead I use string here instead of using the uh the boolean just the way it is.
Go ahead and set true.
Now let's go ahead and save this.
And uh, if we go ahead and go over here and go down to eco, we want to check which of these is, uh,
outdated and war that is not US debt.
Now go ahead and replace the E with the function name outdated.
So we're calling the function outdated now.
And let's go ahead and refresh this and check this out.
And it says unexpected token in line 21.
So that is what we have right here.
So go ahead and put this back.
This is a greater than or equal.
This is what it's supposed to be.
Go ahead and save this and check it out.
So with the one we are checking is false because Q1 is 2030.
So that is still a current car.
And if we go ahead and change this to car two and change this to Cat two and go ahead and refresh this,
you can see that is true because Q2 is 1997.
So we need to go ahead and change this car two to like a 2051 and save.
These are the fresh.
Let's check it out.
That is false.
So you can see that.
So object function helps us to be able to add some functions into our classes and it will help us to,
you know, to implement some specific tasks on the object.
And you can see that I created this function once.
And where would two use that on both of these.
Because whenever you create a function inside here it's a it's going to be implemented into the object
of that class.
Because both of these objects are the objects of the class.
Cutter, you understand, is both of the object and the object of the class car.
So if we create more and more of this object, and eventually you create your application to add objects
of that particular class you're working with.
So and now anytime you check true or false, either one of them, it will go ahead and give you the
output.
So this is about construct a object functions in PHP.
Go ahead and check more on that.
And if you have any question go ahead and use the question and answer section.
And I'm going to get back to you as soon as possible.
Thank you so much.
And I'm going to see you in the next video lecture.