- PHP >= 5.6.4
- OpenSSL PHP Extension
- PDO PHP Extension
- Mbstring PHP Extension
- Tokenizer PHP Extension
- XML PHP Extension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Router { | |
public static function Map($method, $page, $closure) { | |
$reqMethod = $_SERVER['REQUEST_METHOD'] === strtoupper($method); | |
$reqPage = $_GET['params'] === ltrim($page, '/'); | |
if($reqMethod and $reqPage) { | |
return (is_object($closure) && ($closure instanceof Closure)) ? $closure() : $closure; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
It works these urls: | |
Without sub dir | |
http://site.com/index.php | |
http://site.com/index.php/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class DB | |
{ | |
private $select; | |
private $where; | |
private $where_and; | |
private $where_or; | |
public function select($select, $fields) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
php artisan tinker | |
$user = new App\User; | |
$user->name="Admin"; | |
$user->email="[email protected]"; | |
$user->password=bcrypt('1234'); | |
$user->save(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Random Password Generator | |
* @param $olustur = new SifreOlusturucu(); or $olustur = new SifreOlusturucu(16); | |
* @param $olustur->sifreOlustur(); // output: wIsLiXzH1uP@hqSm | |
* @author Ali GOREN | |
* @copyright Ali GOREN | |
* @link http://blog.aligoren.net | |
* @package: SifreOlusturucu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class St { | |
public static function pippa($obj) { | |
print_r($obj); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
new MyClass->my_method() isn't possible. However, there are a couple of solutions, of which the best seems to be the most unlikely as well. | |
**** | |
Note: Make sure you read/skim to the end, even if you figure out the first solution quickly | |
(which you should). The second solution has a bit of brief research to go along with it! :-) | |
**** | |
At times, it can be useful to have a class that maintains state long enough to complete a | |
cycle, but doesn't get stored in memory. No extra baggage needed, right? |