####Why numbering should start at one
####Example
$arr = new SenseArr();
$arr[] = 'foo';
print_r($arr);Result
| <?php | |
| class Session{ | |
| public static function add( $name, $value ){ | |
| $_SESSION[ $name ] = $value; | |
| } | |
| public static function del( $name ){ | |
| unset( $_SESSION[ $name ] ); | |
| } | |
| <?php | |
| /** | |
| * @author @GabrielJMJ /twitter | |
| * @description Abstract class to define a interface of a converter | |
| * @link https://gist.github.com/GabrielJMJ/6977968 Gist on GitHub | |
| **/ | |
| abstract class Converter{ | |
| protected $valueWithCurrency; | |
| protected $toCurrency; |
| <?php | |
| if( isset( $_SERVER['HTTP_REFERER'] ) and !stristr( $_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'] ) ){ | |
| //... | |
| } |
| <?php | |
| print_r(quadEq(1, 2, 1));// a=1 b=2 c=3 (x² + 2x + 3 = 0) | |
| //Result: array(-1) |
| $images = array( | |
| 1 => 'https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcSwN2pF0jnnNlxtNRythauTtBgtNFTSx0ucRHeKfahoo33XEtFjUEYVfnE', | |
| 2 => 'http://i7.photobucket.com/albums/y266/Linkforce712/SEA01.png' | |
| ); | |
| $arr = array(1, 1, 1, 1, 1, 1); | |
| $arr2 = array(1, 2, 2, 2, 2, 1); | |
| $arr3 = array(1, 1, 1, 1, 1); | |
| function transform($images) |
####Why numbering should start at one
####Example
$arr = new SenseArr();
$arr[] = 'foo';
print_r($arr);Result
| <?php | |
| namespace Gabrieljmj; | |
| trait HideStaticMethods | |
| { | |
| public function __call($method, $args) | |
| { | |
| return foward_static_call_array(array(self, $method), $args); | |
| } | |
| } |
| <?php | |
| class Environment | |
| { | |
| private $shouldState; | |
| private $verbs = array('be', 'have'); | |
| private $toTest; | |
| public function __construct($toTest, $shouldState = false, $verb = null) | |
| { | |
| $this->toTest = $toTest; |
| psr4.add('Gabrieljmj\\Blog\\', 'modules/gabrieljmj/blog/'); | |
| psr4.add('Gabrieljmj\\Blog\\Controller\\', 'modules/gabrieljmj/blog/constrollers/'); | |
| var postsController = psr4.use('Gabrieljmj\\Blog\\Posts'); //require('modules/gabrieljmj/blog/Posts') | |
| var postsController = psr4.use('Gabrieljmj\\Blog\\Controller\\Posts'); //require('modules/gabrieljmj/blog/controllers/posts') |