Exemple #1
0
class database
{
    protected $sql;
    //Property Variable
    function __construct($host, $username, $password, $dbname)
    {
        //Method
        $this->sql = new mysqli($host, $username, $password, $dbname);
    }
    function view($table, $select = "*", $name = "", $con = "", $val = "")
    {
        $where = ($name != "" and $con != "" and $val != "") ? "WHERE {$name} {$con} '{$val}'" : "WHERE 1";
        //die("SELECT {$select} from {$table} {$where}");
        return $this->sql->query("SELECT {$select} from {$table} {$where}")->fetch_all(1);
    }
}
class abc extends database
{
    function __construct($host, $username, $password, $dbname)
    {
        parent::__construct($host, $username, $password, $dbname);
    }
    function login($username, $password)
    {
        return $this->sql->query("select * from user where username = '******' AND password = '******'")->fetch_assoc();
    }
}
//$db = new database("localhost","root","root","helfer1");
$db = new abc("localhost", "root", "root", "helfer1");
$result = $db->view("grupos", "nombre", "id_grupo", "=", "4");
print_r($result);
Exemple #2
0
}
interface template2 extends template1
{
    public function f2();
}
class abc implements template2
{
    public function f2()
    {
        return "Function F2 Calling";
        //function implementation
    }
    public function f1()
    {
        return "Function F1 Calling";
    }
}
$onject = new abc();
echo $onject->f1();
/*
Differences between abstract class and interface in PHP
Following are some main difference between abstract classes and interface in php

In abstract classes this is not necessary that every method should be abstract. But in interface every method is abstract.
Multiple and multilevel both type of inheritance is possible in interface. But single and multilevel inheritance is possible in abstract classes.
Method of php interface must be public only. Method in abstract class in php could be public or protected both.
In abstract class you can define as well as declare methods. But in interface you can only defined your methods.

Q: What is Virtual Class.
	: A virtual function is a member function that is declared within a base class and redefined by a derived class
*/
<?php

Tieba_service::call('abc');
tieba_service::call('abc');
tieba_service::abc('abc');
abc::call('abc');
<?php

Bingo_Log::notice('abc');
abc::notice('abc');
Bingo_Log::warning('abc');
Exemple #5
0
            echo "\n sucess";
        } else {
            echo "aray not exist";
        }
    }
    public function __unset($class)
    {
        echo "echoinhg";
        unset($this->{$array}[$name]);
    }
    public function __call($name, $value)
    {
        echo "method calling";
    }
    public function __toString()
    {
        echo get_class($this);
    }
    public function __invoke($abc)
    {
        echo "object invoked";
    }
}
$ab = new abc();
//	$ab->$a= 'XYZ';
//unset($ab->$a);
//echo "bye1";
//echo $ab-> $a  = "world" ;
echo $ab;
$ab->hello();
$ab("hi");
Exemple #6
0
        foreach ($aliases as $key => $aliases) {
            foreach ((array) $aliases as $alias) {
                $this->alias($key, $alias);
            }
        }
    }
    public function alias($abstract, $alias)
    {
        $this->aliases[$alias] = $abstract;
    }
    public function getaliases()
    {
        return $this->aliases;
    }
}
$abc = new abc();
$abc->registerCoreContainerAliases();
var_export($abc->getaliases());
/**
array (
  'Illuminate\\Foundation\\Application' => 'app',
  'Illuminate\\Contracts\\Container\\Container' => 'app',
  'Illuminate\\Contracts\\Foundation\\Application' => 'app',
  'Illuminate\\Console\\Application' => 'artisan',
  'Illuminate\\Contracts\\Console\\Application' => 'artisan',
  'Illuminate\\Auth\\AuthManager' => 'auth',
  'Illuminate\\Auth\\Guard' => 'auth.driver',
  'Illuminate\\Contracts\\Auth\\Guard' => 'auth.driver',
  'Illuminate\\Auth\\Passwords\\TokenRepositoryInterface' => 'auth.password.tokens',
  'Illuminate\\View\\Compilers\\BladeCompiler' => 'blade.compiler',
  'Illuminate\\Cache\\CacheManager' => 'cache',
<?php

class abc
{
    private $a = 1;
    private $b = 2;
    protected $c = 3;
    protected $d = 4;
    public $e = 5;
    public $f = 6;
    function a()
    {
        echo $this->e;
    }
    function b()
    {
    }
}
$anything = new abc();
echo '<pre>';
print_r($anything->a());