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 | |
#[attribute] | |
class Route | |
{ | |
public $method; | |
public $path; | |
public function __construct($method, $path) { |
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 | |
/** | |
* @var array[] | |
* @var string | |
* @var string | |
*/ | |
function csv($aCsv, $sDelimiter = ',', $sLineBreak = "\n") | |
{ | |
return implode($sLineBreak, array_map( |
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 | |
echo "Begin ...\n"; | |
for( $i = 0 ; $i < 10 ; $i++ ) | |
{ | |
echo $i . "\n"; | |
flush(); | |
sleep(1); | |
} | |
echo "End ...\n"; |
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 | |
declare(strict_types=1); | |
/** | |
* wrapper around the bcdec extension | |
* | |
* @see https://www.php.net/manual/en/book.bc.php | |
*/ | |
class Bcdec |
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 | |
/** | |
* clear overview of backtrace | |
* | |
* @return string | |
*/ | |
function backTrace($traces = null) | |
{ | |
$traces = $traces ?? debug_backtrace(); |
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 singleton | |
{ | |
/** | |
* protect the construct | |
*/ | |
protected function __construct() | |
{ | |
} |
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 | |
use Psr\Http\Message\RequestInterface; | |
use Psr\Http\Message\ResponseInterface; | |
use Psr\Log\LoggerInterface; | |
class LoggingMiddleware | |
{ | |
/** @var LoggerInterface */ | |
private $logger; |
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 | |
function test1($arr) | |
{ | |
$arr = array_fill(0, 10000, true); | |
$start = microtime(); | |
for ($i = 0; $i < count($arr); $i++) { | |
array_fill(0, 500, "abc"); | |
} |
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 | |
/** @see https://github.com/beberlei/assert */ | |
require __DIR__ . '/vendor/autoload.php'; | |
use Assert\Assertion as A; | |
$sLang = 'en'; |
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 Event | |
{ | |
public $priority; | |
public $call; | |
public $name; | |