Using the method

functions in a class are called methods.

How to use the method

<?php
    class classname
    {
        function methodname()
        {
        }
    }
?>

Methods, like properties, have access restrictions. Its functionality is the same.
Then, following the previous course ...
Cars also have functions. The biggest feature is the ability to run, the ability to stop, and the ability to rotate. To implement these features, we apply functions.
Then we will make a running method, a stopping method, and a rotating method.
Run the run method, stop the stop method, and turn the rotating method.

<?php
    class Car
    {
        public $wheels;
        public $doors = 4;
        protected $color = 4;
        private $size;
        private $company;

        public function run()
        {
            return "The car is running.";
        }

        protected function stop()
        {
            return "car stops.";
        }

        protected function turn()
        {
            return "turnning car";
        }
    }
?>

We created the properties and methods for the car class above.
Let's try it now To use, create an instance of the above class.
Then we'll create an instance in the next lesson.