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 | |
$collection = [$obj1, $obj2, $obj3]; | |
// Dumb way | |
$matches = array_reduce($collection, function ($matches, $object) { | |
if ($object->isMatch()) { | |
$matches[] = $object; | |
} | |
return $matches; |
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 | |
/* | |
I'm trying to validate times in a PHP application. Some of the formats | |
I want to allow include: | |
- 12am (12 hour clock) | |
- 1:45 pm (space optional) | |
- 23:59 (24 hour clock) | |
- 00:16 |
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
/** | |
* Select | |
* | |
* Generates the SELECT portion of the query | |
* | |
* @param string | |
* @param mixed | |
* @return CI_DB_query_builder | |
*/ | |
public function select($select = '*', $escape = NULL) |
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 | |
$a = array(); | |
$max_odd = 93; | |
$max_even = 72; | |
$prefix = 'B-'; | |
$o = -1; | |
$e = 0; |