- 1
Why is there no classes in php?
6 Answers
+ 4
Hey, it is actually possible to create classes in php. See the lesson below to learn more.
https://www.sololearn.com/learn/985/?ref=app
+ 3
PHP is oop language
+ 2
Hey you must be on the browser right? As it works on mobile and I just checked it on the browser and I saw 404, allow me to copy the info:
+ 2
PHP Classes php
In PHP, a class can include member variables called properties for defining the features of an object, and functions, called methods, for defining the behavior of an object. A class definition begins with the keyword class, followed by a class name. Curly braces enclose the definitions of the properties and methods belonging to the class.
For example:
class Person {
public $age; //property
public function speak() { //method
echo "Hi!"
}
}
The code above defines a Person class that includes an age property and a speak() method.
A valid class name starts with a letter or underscore, followed by any number of letters, numbers, or underscores.
Notice the keyword public in front of the speak method; it is a visibility specifier.
The public keyword specifies that the member can be accessed from anywhere in the code.
There are other visibility keywords and we will learn about them in later lessons.
Courtesy of James Flanders
0
Toni what do you mean by oop language. Though I have heard about it but can you explain to a laymen?
0
Minato these links never work. It throws 404.