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 | |
abstract class Dao { | |
protected $db; | |
public function __construct(PDO $db) { | |
$this->db = $db; | |
} | |
public function setDb(PDO $db) { | |
$this->db = $db; |
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
#include "php_sample.h" | |
#define CODEANGEL_NS "CodeAngel" | |
PHP_FUNCTION(sample_hello_world) | |
{ | |
php_printf("Hello World!\n"); | |
} | |
static const zend_function_entry php_sample_functions[] = { |
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
LoadModule php5_module modules/libphp5.so | |
<FilesMatch \.php$> | |
SetHandler application/x-httpd-php | |
</FilesMatch> |
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 Crypter { | |
public static $cipher = MCRYPT_TWOFISH; | |
public $key; | |
public $authKey; | |
public function __construct($key, $authKey) { | |
$this->key = base64_decode($key); | |
$this->authKey = base64_decode($authKey); | |
} |
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 | |
$str = '[0710:020602938:7041]'; | |
switch(1) { | |
case preg_match('/^(\[)[A-Z0-9]{4}:(' . rand(10000,29999) . '|' . rand(50000,99999) . '):[A-z]{3}(\])(.*)+/', $str): | |
/* ... */ | |
break; | |
case preg_match('/^(\[)[A-Z0-9]{4}:[0-9]{9}:[0-9]{4}(\])+/', $str): | |
/* ... */ | |
break; |
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 bin2hex (s) { | |
// From: http://phpjs.org/functions | |
// + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) | |
// + bugfixed by: Onno Marsman | |
// + bugfixed by: Linuxworld | |
// + improved by: ntoniazzi (http://phpjs.org/functions/bin2hex:361#comment_177616) | |
// * example 1: bin2hex('Kev'); | |
// * returns 1: '4b6576' | |
// * example 2: bin2hex(String.fromCharCode(0x00)); | |
// * returns 2: '00' |
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 StreamThingy { | |
public $fh; //this si your fopen statement | |
public $readFunc; | |
public function onRead($function) { | |
$this->readFunc = $function; | |
} | |
public function execute() { |
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 Match { | |
public $id; | |
public $challenger; | |
public $defender; | |
} |
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
<project name>/ | |
src/ --where you put your classes according to psr-4 | |
tests/ -- gotta have your unit/integration/function tests yo | |
vendor/ -- where composer puts third party libs | |
public/ -- docroot |
OlderNewer