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
./ext/bcmath/bcmath.c: php_error_docref(NULL TSRMLS_CC, E_WARNING, "Division by zero"); | |
./ext/bcmath/bcmath.c: php_error_docref(NULL TSRMLS_CC, E_WARNING, "Division by zero"); | |
./ext/bcmath/bcmath.c: php_error_docref(NULL TSRMLS_CC, E_WARNING, "Square root of negative number"); | |
./ext/bz2/bz2.c: php_error_docref(NULL TSRMLS_CC, E_WARNING, "length may not be negative"); | |
./ext/bz2/bz2.c: php_error_docref(NULL TSRMLS_CC, E_WARNING, "could not read valid bz2 data from stream"); | |
./ext/bz2/bz2.c: php_error_docref(NULL TSRMLS_CC, E_WARNING, "'%s' is not a valid mode for bzopen(). Only 'w' and 'r' are supported.", mode); | |
./ext/bz2/bz2.c: php_error_docref(NULL TSRMLS_CC, E_WARNING, "filename cannot be empty"); | |
./ext/bz2/bz2.c: php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot use stream opened in mode '%s'", stream->mode); | |
./ext/bz2/bz2.c: php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot use stream opened in mode '%s'", stream->mode); |
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 | |
/** | |
* Run an XPath query against an HTML string and returns the results | |
* | |
* @param string $xpath The XPath query to run on $thml | |
* @param string $html The HTML to parse. Uses the previously used string if omitted | |
* @return array | |
*/ | |
function xpath_match_all($query, $html = '') | |
{ |
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 Caster | |
{ | |
/** | |
* Casts an Array to an instance of a class | |
* | |
* This method will return an instance of the given $className with all | |
* elements in the array being public members of the instance. The method | |
* uses serialization to work, so no constructor will be called to get the | |
* instance of $className. The returned instance may behave unexpectedly |
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 | |
$functions = get_defined_functions(); | |
foreach($functions['internal'] as $function) { | |
$GLOBALS[$function] = function() use ($function) { | |
return call_user_func_array( | |
$function, | |
func_get_args() | |
); | |
}; |
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 AttributeReader | |
{ | |
/** | |
* Interceptor for non-accessible properties | |
* | |
* @param string $property | |
* @returns mixed | |
*/ | |
public function __get($property) |
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 | |
for ($i = 1; $i <= 100; $i++) { | |
echo | |
$i % 3 === 0 ? 'Fizz' : '', | |
$i % 5 === 0 ? 'Buzz' : '', | |
$i % 3 && $i % 5 ? $i : '', | |
PHP_EOL; | |
}; |
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 lint($code) | |
{ | |
$code = strpos($code, '<?php') === 0 ? $code : "<?php $code"; | |
$filename = tempnam(sys_get_temp_dir(), 'lnt'); | |
file_put_contents($filename, $code); | |
exec(PHP_BINARY . " -l $filename", $errors); | |
unlink($filename); |
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
function getLinesInRandomOrder($filePath) | |
{ | |
$file = new SplFileObject($filePath); | |
$file->setFlags(SplFileObject::DROP_NEW_LINE | SplFileObject::SKIP_EMPTY); | |
$file->seek(PHP_INT_MAX); | |
$linesToTry = range(0, $file->key()); | |
shuffle($linesToTry); | |
foreach ($linesToTry as $line) { | |
$file->seek($line); | |
yield $file->current(); |
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
### Keybase proof | |
I hereby claim: | |
* I am gooh on github. | |
* I am gooh (https://keybase.io/gooh) on keybase. | |
* I have a public key whose fingerprint is 729C 589F B492 0AE6 C22C 08F3 73BC 4368 C9EB 252E | |
To claim this, I am signing this object: |
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 DataCollection implements \IteratorAggregate | |
{ | |
private $data; | |
public function __construct($data) | |
{ | |
$this->data = $data; | |
} |
OlderNewer