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 | |
$H = '[0-9a-fA-F]'; | |
$NL = '\n|\r\n|\r|\f'; | |
$UNICODE = '\\\\' . $H . '{1,6}[ \t\r\n\f]?'; | |
$s = '\x{80}-\x{D7FF}\x{E000}-\x{FFFD}\x{10000}-\x{10FFFF}'; | |
//$s = '\X'; // tmp | |
$NONASCII = '[' . $s . ']'; | |
$ESCAPE = $UNICODE . '|\\[ -~' . $s . ']'; | |
$NMSTART = '[_a-zA-Z]|' . $NONASCII . '|' . $ESCAPE; |
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 | |
$input = '1r3e56f8'; | |
$merge = '6f8g'; | |
$res = NULL; | |
for ($i = min(strlen($input), strlen($merge)), $l = strlen($merge); $i > 0; $i--) { | |
$iPart = substr($input, -$i); | |
$mPart = substr($merge, 0, $i); | |
if (substr_compare($iPart, $mPart, 0) === 0) { |
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 cutPrice($price) | |
{ | |
return number_format($price, is_float($price) ? 2 : 0, '.', ' '); | |
} | |
var_dump(cutPrice(12185418)); | |
var_dump(cutPrice(12185418.4841)); |
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 Foo { | |
public function __construct() { | |
require_once __DIR__ . '/b.php'; | |
Some::foo($this); | |
} | |
} | |
new Foo; |
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 | |
trait T { | |
public function xyz() | |
{ | |
echo __TRAIT__, PHP_EOL; | |
} | |
} | |
class A { |
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 Nette\Http; | |
require $libsDir . '/Nette/loader.php'; | |
// init | |
$requestFactory = new Http\RequestFactory(); | |
$session = new Http\Session($requestFactory->createHttpRequest(), new Http\Response()); |
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
#!/usr/local/bin/php | |
<?php | |
/** | |
* @author Michael Moravec | |
*/ | |
$targetDir = $argc > 1 ? $argv[1] : getcwd(); | |
if (!is_dir($targetDir)) throw new \InvalidArgumentException("Invalid dir '$targetDir'."); |
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 | |
if (is_array($value) && (!isset($value['class']) || !is_scalar($value['class']))) { | |
throw new \InvalidArgumentException("Repository $name doesn't have defined 'class' parameter"); | |
} | |
$className = is_array($value) ? $value['class'] : $value; |
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 | |
trait T | |
{ | |
public function foo(array $x) | |
{ | |
echo __METHOD__; | |
} | |
} |
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
./configure --prefix=/usr/local --localstatedir=/var --with-layout=GNU --with-config-file-path=/usr/local/etc/php --with-config-file-scan-dir=/usr/local/etc/php/conf.d --enable-shared --enable-debug --with-pear --enable-cli --enable-cgi --enable-fpm --disable-short-tags --enable-bcmath --enable-calendar --enable-exif --enable-ftp --enable-gd-native-ttf --enable-intl --enable-json --enable-mbstring --enable-soap --enable-sockets --enable-xml --enable-zip --with-bz2 --with-curl --with-enchant --with-gd --with-gettext --with-gmp --with-iconv --with-imap --with-imap-ssl --with-mcrypt --with-mhash --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-mhash --with-mysql-sock=/var/run/mysqld/mysqld.sock --with-openssl --with-pcre-regex --enable-pdo --with-pdo-mysql=mysqlnd --with-pdo-pgsql --with-pdo-sqlite --with-pgsql --with-pspell --with-readline --with-snmp --with-sqlite3 --with-tidy --with-xmlrpc --with-xsl --with-zlib --without-db2 --without-db3 --with-kerberos --with-jpeg-dir=/usr/lib |