PHP code example of shiwolang / base

1. Go to this page and download the library: Download shiwolang/base library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

shiwolang / base example snippets


class Nihao1 extends Object
{
    public $nihao = "asdf";
    public function nihao()
    {
        echo "nihao1";
    }
}
class Nihao2 extends Object
{
    public function nihao()
    {
        echo "nihao2";
    }
}
class Nihao3 extends Object
{
}
class Nihao4 extends Object
{
    public $nihao = "asdf";

    protected static function extend()
    {
        return parent::extend(Nihao1::className(), Nihao2::className());
    }

    public static function hello()
    {

        echo "asdf";
    }
}
class Nihao5 extends Object
{
    protected static function extend()
    {
        return parent::extend(Nihao3::className());
    }
}
class Nihao6 extends Object
{
    protected static function extend()
    {
        $aa = parent::extend(Nihao4::className(), Nihao5::className());

        return $aa;
    }
}

var_dump(Nihao6::__mro__());
/**结果**
array(5) {
  [0] =>
  string(23) "test\base\object\Nihao4"
  [1] =>
  string(23) "test\base\object\Nihao1"
  [2] =>
  string(23) "test\base\object\Nihao2"
  [3] =>
  string(23) "test\base\object\Nihao5"
  [4] =>
  string(23) "test\base\object\Nihao3"
}
**/