‫Okay.
‫So up to this point we've we're able to create a class and we're able to create objects from that class.
‫And what we've been doing is creating instances.
‫Right.
‫So we can instantiate a new object through a class.
‫And we can do that many times and have many instances.
‫But there may be cases where you don't need multiple instances.
‫All right.
‫So let me show you what I mean.
‫Let's jump in and let's create a class called Math Utility.
‫And let's create just a property called pi.
‫So we'll say public and we'll call it pi.
‫And we'll set it to the value of 3.14.
‫So this is just a regular class with a regular property.
‫And what we could do is instantiate objects math utility objects with this.
‫So for instance let's say math util one.
‫And then we could use the new keyword to instantiate the math utility object or a math utility object.
‫And then I can use that instance.
‫So let's say math util one.
‫And then I can access using the arrow I can access any properties or methods such as pi like that.
‫So let's reload and we get 3.14.
‫And I can create multiple instances.
‫So I can copy that down.
‫And we can call this variable math util two.
‫And then I could copy this down and I could say math util two.
‫So that this particular instance and then call pi on that.
‫Now like I said, there may be cases where you don't need to have multiple objects or multiple instance.
‫So in that case, what we can do is set up either a property or a method to static.
‫So I'm going to do that actually let me leave that there and I'll show you what happens if we then.
‫Make that static.
‫So I'm going to get errors.
‫It says accessing static property math util pi as non static.
‫So there's a different format if we want to access this.
‫So let's get rid of all this.
‫And what we would do is use the class name directly.
‫So math utility.
‫And then instead of using an arrow we use what's called the scope resolution operator which is double
‫colon.
‫And then the name of the property and we'd have the money sign here.
‫All right.
‫So if I save that and reload then I should get 3.14.
‫Now you can do the same with methods.
‫Let's say that we want to create public static function and add, and let's use the rest operator.
‫And we'll pass in a variable of nums okay.
‫And then we'll just we'll return and we'll use array.
‫Array, underscore sum to add whatever numbers are passed in together.
‫All right, so now if I come down here and let's say echo and remember we used the name of the class
‫scope resolution operator and then the name of the method.
‫And I'll pass in one through five.
‫And if I reload we get 15.
‫Okay, so it's just a different syntax.
‫If you're using static properties and methods, you're going to use the class name instead of the instance
‫name, the scope resolution operator, and then the property or the method.