×
          
              
          
      
      Clear all filters including search bar
          
        Valeri Tandilashvili's Personal Professional Blog
      
    class Foo {
    private $color;
    public function bar() {
        echo 'before';
        $this->color = "blue";
        echo 'after';
    }
}
// Foo::bar();  
// Deprecated
$obj = new Foo;
$obj::bar();Non-static method Foo::bar() should not be called staticallyIn PHP 7, calling non-static methods statically is deprecated, and will generate an E_DEPRECATED warning. Support for calling non-static methods statically may be removed in the futureinterface IMusician {
    public function play();
}
class Guitarist implements IMusician {
    public function play() { 
        echo "playin a guitar";
    }
}Guitaristplay()IMusician.logout.home.home {
    flex-grow: 1;
}
.logout{
    flex-grow: 2;
}p::first-letter {
    color: blue;  
    font-size: 20px;  
    font-weight: bold;  
    background-color: yellow;
}json_decodestdClass$json = '{ "foo": "bar", "number": 42 }';
$stdInstance = json_decode($json);
//Example with StdClass
echo get_class($stdInstance) . ':' . PHP_EOL;
echo $stdInstance->foo . PHP_EOL; //"bar"
echo $stdInstance->number . PHP_EOL . PHP_EOL;
//Example with associative array
echo 'associative array:' . PHP_EOL;
$array = json_decode($json, true);
echo $array['foo'] . PHP_EOL; //"bar"
echo $array['number'] . PHP_EOL; //42stdClass$array = array(
    'Property1'=>'hello',
    'Property2'=>'world',
    'Property3'=>'again',
);
$obj = (object) $array;
echo get_class($obj) . ':' . PHP_EOL;
echo $obj->Property3;$array_user = array();
$array_user["name"] = "smith john";
$array_user["username"] = "smith";
$array_user["id"] = "1002";
$array_user["email"] = "smith@nomail.com";
$obj_user = new stdClass;
$obj_user->name = "smith john";
$obj_user->username = "smith";
$obj_user->id = "1002";
$obj_user->email = "smith@nomail.com";if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
    $this->addError('email', 'email must be a valid email');
}p::first-line {
    color: blue;
    font-size: 20px;
    font-weight: bold;
    background-color: yellow;
}.my-form input[type="text"]{
    padding: 8px;
    width: 100%;
}text<div class="container">
  <div class="row">
    <div class="col-sm">
      One of three columns
    </div>
    <div class="col-sm">
      One of three columns
    </div>
    <div class="col-sm">
      One of three columns
    </div>
  </div>
</div>class BaseClass {
    function __construct() {
        print "In BaseClass constructor\n";
    }
}
class SubClass extends BaseClass {
    function __construct() {
        parent::__construct();
        print "In SubClass constructor\n";
    }
}
class OtherSubClass extends BaseClass {
    // inherits BaseClass's constructor
}
// In BaseClass constructor
$obj = new BaseClass();
// In BaseClass constructor
// In SubClass constructor
$obj = new SubClass();
// In BaseClass constructor
$obj = new OtherSubClass();