- include dot files
- numbered keys
- Path not included in value
- no configuration options
- array requires cloned objects
This file contains hidden or 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
echo Carbon::now()->addDays(4); //2015-09-04 20:39:45 | |
echo Carbon::now()->addWeeks(4); //2015-09-28 20:39:56 | |
echo Carbon::now()->subWeeks(4); //2015-09-28 20:39:56 | |
echo Carbon::now()->tomorrow(); //2015-09-01 00:00:00 | |
echo Carbon::now()->yesterday(); //2015-08-30 00:00:00 | |
$time = Carbon::now()->subYears(1)->timestamp; | |
echo $time; //1409488994 | |
$date = Carbon::createFromTimestamp($time); |
This file contains hidden or 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 namespace App\Exceptions; | |
use Exception; | |
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; | |
use Symfony\Component\Debug\ExceptionHandler as SymfonyDisplayer; | |
class Handler extend ExceptionHandler | |
{ | |
/** | |
* Convert the given exception into a Response instance. |
This file contains hidden or 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 | |
function foobar($arg1, $arg2) | |
{ | |
echo __FUNCTION__ . " got $arg1 and $arg2\n"; | |
} | |
class foo | |
{ | |
function bar($arg1, $arg2) |
This file contains hidden or 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 | |
$courses = simplexml_load_file('common/data/courses.xml', 'SimpleXMLIterator'); | |
$courses = new CallbackFilterIterator($courses, 'getCoursesByLevel'); | |
foreach ($courses as $course) { | |
echo "$course->title with $course->author (level: $course->level)<br />"; | |
} |
This file contains hidden or 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 AuthorFilter extends FilterIterator | |
{ | |
/** | |
* @var Iterator | |
*/ | |
private $author; | |
public function __construct(Iterator $iterator, $author) |
This file contains hidden or 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 | |
$files = new RecursiveDirectoryIterator('common'); | |
$files->setFlags(RecursiveDirectoryIterator::SKIP_DOTS | RecursiveDirectoryIterator::UNIX_PATHS); | |
$files = new RecursiveTreeIterator($files); | |
$files->setPrefixPart(RecursiveTreeIterator::PREFIX_LEFT, '⋇'); | |
$files->setPrefixPart(RecursiveTreeIterator::PREFIX_END_HAS_NEXT, '⊩'); | |
$files->setPrefixPart(RecursiveTreeIterator::PREFIX_END_HAS_NEXT, '≀'); | |
$files->setPrefixPart(RecursiveTreeIterator::PREFIX_END_LAST, '∿'); |
This file contains hidden or 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
CREATE DATABASE IF NOT EXISTS table_name COLLATE utf8_general_ci; | |
CREATE USER 'username'@'host' IDENTIFIED BY 'password'; | |
GRANT SELECT, INSERT, UPDATE, DELETE ON table_name.* TO 'username'@'host'; |
This file contains hidden or 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
//截取字符串 | |
$substring = substr($string,$start,$length); | |
//使用给定字符串替换 | |
$new_string = substr_replace($old_string,$new_substring,$start); | |
//反转字符串 | |
string strrev (string $string) | |
//反转字符串(单词) |