http://rmcreative.ru/blog/post/vstrecha-razrabotchikov--voronezh-1--apdeyt
16 марта, 12:00. Бенефит-плаза, кафе «Маруся».
<?php | |
/** | |
* Escapes values | |
* | |
* @param array $values array of values to escape | |
* @return string string ready to be included into SQL statement | |
* @throws CException if one of the values isn't a scalar | |
*/ | |
function escape($values) | |
{ |
<?php | |
function render_level_list($items) | |
{ | |
$level=0; | |
foreach($items as $item) | |
{ | |
if($item->level==$level) { | |
echo "</li>\n"; | |
} |
<?php | |
function cidr_match($ip, $ranges) | |
{ | |
$ranges = (array)$ranges; | |
foreach($ranges as $range) { | |
list($subnet, $mask) = explode('/', $range); | |
if((ip2long($ip) & ~((1 << (32 - $mask)) - 1)) == ip2long($subnet)) { | |
return true; | |
} | |
} |
/** | |
* Get criteria to limit query to match any of tags specified | |
* @access private | |
* @param array $tags | |
* @return CDbCriteria | |
*/ | |
protected function getFindByAnyTagsCriteria($tags) { | |
$criteria = new CDbCriteria(); | |
$pk = $this->getOwner()->tableSchema->primaryKey; |
<?php | |
class X | |
{ | |
private $_b; | |
private $_e; | |
} | |
class Y | |
{ | |
private $_behaviors; |
http://rmcreative.ru/blog/post/vstrecha-razrabotchikov--voronezh-1--apdeyt
16 марта, 12:00. Бенефит-плаза, кафе «Маруся».
<?php | |
/** | |
* Clear assets Command | |
* | |
* Deletes all published assets. | |
* | |
* Usage: | |
* yiic clearassets | |
* | |
* @author Alexander Makarov |
<?php | |
$start = microtime(true); | |
function get_cache_value() { | |
return rand(0, 100).'test'; | |
} | |
$results = array(); | |
for ($i=0; $i<1000; $i++) { | |
$results[] = get_cache_value(); |
<?php | |
class Wrapper { | |
private $value; | |
private $isHit; | |
function __construct($isHit, $value) | |
{ | |
$this->isHit = $isHit; | |
$this->value = $value; | |
} |
<?php | |
$db = new PDO('mysql:host=localhost;dbname=rmc2', 'root'); | |
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | |
function benchmark($callback){ | |
$start = microtime(true); | |
for ($i = 0; $i < 100; $i++) | |
$callback(); | |
return microtime(true) - $start; | |
} |