Results: 1022
The property is used to reorder flex items. The default value is
0
. Negative numbers are also accepted
.main-column {
    flex: 3;
    order: 2;
}
.sidebar-one {
    flex: 1;
    order: 1;
}
Updates all packages and writes the exact versions into
composer.lock
composer update
1. The composer.lock file will be ignored 2.
composer.json
file dependencies will be installed and updated (if a dependency is not installed it will be downloaded)
#nav li {
    list-style: none;
    float: left;
    padding: 0 15px 0 0;
}
It is not possible to use
$this
inside static methods
class Greeting {
    public $nonStatic = 'some value';
    
    public static function hello() {
        return $this->nonStatic;
    }
}

// echo Greeting::hello();

$obj1 = new Greeting();
echo $obj1->hello();
After executing the above code, following error will be generated:
Fatal error:  Uncaught Error: Using $this when not in object context
we can use static properties inside object methods (non-static methods)
We can use static properties inside non-static methods but we can't use
$this
inside static methods
class Circle {
    public static $pi = 3.1415926535;
    public $radius;
    
    public function __construct($radius) {
        $this->radius = $radius;
    }
    
    public function getArea() {
        return pow($this->radius, 2) * self::$pi;
    }
    
    public function getPerimeter() {
        return $this->radius * 2 * self::$pi;
    }
}

$circle1 = new Circle(5);
echo "\nArea: " . $circle1->getArea();
echo "\nPerimeter: " . $circle1->getPerimeter();
ALTER TABLE
Adds column
personal_id
after
api_method
column in
requests
table
ALTER TABLE requests
ADD COLUMN personal_id VARCHAR(15) AFTER api_method;
If we run the same
alter
statement one more time, we will get the following error with code
1060
Error Code: 1060. Duplicate column name 'personal_id'
If we want to delete a column from a table, we use the following command
ALTER TABLE `requests` 
DROP COLUMN `status_id`;
static variable in a function
There can be a static local variable in a function that is declared only once (on the first execution of a function) and can store its value between function calls
function foo()
{
   static $numOfCalls = 0;
   
   $numOfCalls++;
   echo "this function has been executed " . $numOfCalls . " times" . PHP_EOL;
}

foo();
foo();
foo();
After executing the ebove code,
$numOfCalls
static variable gets incremented and the following text is printed:
this function has been executed 1 times
this function has been executed 2 times
this function has been executed 3 times
differences and similarities between static and constant
Differences:
constant can not be changed
static variable can not be accessed with the class object
dollar sign is needed to access static variable inside and outside of the class
constant name can not be a keyword, e.g. class (BUT: function, self, parent, static)
Similarities :
both of them are class members
both of them are accessible with "self" keyword inside the class
Examples of using class constant
class Goodbye {
  const LEAVING_MESSAGE = "Thank you for visiting US!\n";
  public function byebye() {
    echo self::LEAVING_MESSAGE;
  }
}

$goodbye = new Goodbye();

// Access const variable with getter method
$goodbye->byebye();

// Access const variable with class name
echo Goodbye::LEAVING_MESSAGE;

// Access const variable directly with object
echo $goodbye::LEAVING_MESSAGE;
About class constants:
Constants cannot be changed once it is declared
Class constants are case-sensitive
A class constant is declared inside a class with the const keyword
It is recommended to name the constants in all uppercase letters
__destruct
method will be executed at the end (before the script stops execution)
class Bill {
    public $dinner = 20;
    public $dessert = 5;
    public $drink = 3;
    
    public $bill = 0;
    public function __construct() {
        $this->bill = 10;
    }
    public function dinner($count) {
        $this->bill += $count * $this->dinner;
        return $this;
    }
    public function dessert($count) {
        $this->bill += $count * $this->dessert;
        return $this;
    }
    public function drink($count) {
        $this->bill += $count * $this->drink;
        return $this;
    }
    public function __destruct() {
        echo $this->bill;
    }
}

$bill = new Bill;

$bill->dinner(3)->dessert(2)->drink(1);
Results: 1022