×
Clear all filters including search bar
Valeri Tandilashvili's Personal Professional Blog
Request URL
- reqeusted URL by a user
Request Method
- HTTP method that is used for the request
Status Code
- status code shows how successful the request was
Remote Address
- server address that the website is hosted toabstract class AbstractClass
{
// Force Extending class to define this method
abstract protected function getValue();
abstract protected function prefixValue($prefix);
// Common method
public function printOut() {
print $this->getValue() . "\n";
}
}
About abstract class:
Classes defined as abstract cannot be instantiated
Any class that contains at least one abstract method must also be abstract
Methods defined as abstract simply declare the method's signature - they cannot define the implementation
echo self::$someProperty;
Outside a classWheather::$someProperty;
self::celsiusToFarenheit(20);
Outside a classWheather::celsiusToFarenheit(20);
__destruct
gets called when we delete an object manually.
If we don't delete the object during the code execution, it will be called automatically at the end of the code executionclass User {
public $username;
public $friends = ['Tom','David'];
function __construct($name) {
$this->username = $name;
print $this->username . "'s object is created'\n";
}
function __destruct() {
print $this->username . "'s object is deleted'\n";
}
}
$user1 = new User('George');
$user2 = new User('David');
echo $user1->username . "\n";
__construct
gets called when a new object of the class gets createdclass User {
public $username;
public $friends = ['Tom','David'];
function __construct($name) {
$this->username = $name;
// print "In BaseClass constructor\n";
}
public function addFriend($friend_name) {
$this->friends[] = $friend_name;
}
}
$user1 = new User('George');
echo $user1->username;
class User {
public $username = 'George';
public $friends = ['Tom','David'];
public function addFriend($friend_name) {
$this->friends[] = $friend_name;
}
}
$user1 = new User();
print_r( get_class_methods('User') );
class User {
public $username;
public $friends;
public function addFriend($friend_name) {
$this->friends[] = $friend_name;
}
}
$user1 = new User();
print_r( get_class_vars('User') );
get_class
functionclass User {
public $username;
public $friends;
public function addFriend($friend_name) {
$this->friends[] = $friend_name;
}
}
$user1 = new User();
echo get_class($user1);