happy cat image

Start Web Coding

Your First step toward web coding,
Start Web Coding

change UI

Using properties

Properties are variables
Within a class, you name a variable as a property.

How to use properties

<?php
    class classname
    {
    Property name;
    or
    Property name = value;
    }
?>

I'll continue the course in front of you.
What would a car look like, wheels, doors, what color, medium, heavy or truck, a car company, and so on?
In the next lesson, we will create wheel variables, door variables, color variables, size variables, and company variables in the car class.
There is a separate name for the variables used within the class. The name is property.
Then we'll make the wheel, door, color, size, and company properties. Wheels means wheels, doors means doors.

<?php
    class Car
    {
        $wheels = 4;
        $doors = 4
        $color;
        $size;
        $company;
    }
?>

I created a property. When declaring properties and functions in a class, you specify the access limiter first. Next, we will look at access modifiers.

강좌로 돌아가기