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 | |
// Conclusion: NULL is in this case considered to be of no value, and PHP | |
// thinks that it is OK to overwrite, but integers are not treated the same | |
// This code will assign NULL and the ignore that NULL was assigned and create a stdClass: | |
$a = NULL; | |
$a->test = "apa"; // should warn in my oppinion | |
print_r($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 | |
// Conclusion: NULL and unset have unpredictable behavior | |
// === NULL are in some cases same as unset === | |
// This code will assign a value, then assign NULL, and the result will show that | |
// PHP think this is same as unset() | |
$a = "test"; | |
$a = NULL; // will be same as unset() | |
echo (isset($a) ? "true" : "false") . "\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 | |
class SemiStaticClass { | |
public function echoWhoIAm() { | |
echo 'I\'m ' . __FUNCTION__ . ' in class ' . __CLASS__; | |
// If this doesn't exists, then this function is statically called | |
if (! isset($this)) { | |
echo '... and I\'m statically called! Nice!'; | |
} | |
echo "\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
import logging | |
import re | |
from connexion.resolver import RestyResolver | |
logger = logging.getLogger('connexion.resolver') | |
class NestedRestyResolver(RestyResolver): | |
"""Overrider RestyResolver to support complex paths (/a/b/c/ => a.b.c)""" |
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 | |
// Conclusion: This code will cause Segmentation fault, because | |
// of recursive calls to __clone(), but PHP should handle this. | |
// Bug filed here: http://bugs.php.net/bug.php?id=49664 | |
date_default_timezone_set('America/Los_Angeles'); | |
class Test { | |
public $previous, $next = NULL; |