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 | |
declare(strict_types=1); | |
function add(int $x, int $y): int { | |
return $x + $y; | |
} | |
echo add(1, 2) . PHP_EOL; |
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 | |
ClassLoader::addDirectories( | |
array( | |
app_path() . '/commands', | |
app_path() . '/controllers', | |
app_path() . '/controllers/admin', // <--- added | |
app_path() . '/models', | |
app_path() . '/database/seeds', |
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
create table users ( | |
id serial primary key, | |
username text not null, | |
password text not null, | |
created timestamp | |
); | |
INSERT INTO users (username, password, created) VALUES('osaka', '', NOW()); | |
INSERT INTO users (username, password, created) VALUES('kyoto', '', NOW()); | |
INSERT INTO users (username, password, created) VALUES('hyogo', '', NOW()); |
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 A { | |
public $v = 1; | |
public function func() { | |
call_user_func(array($this, 'some')); | |
} | |
public function some() { | |
echo $this->v; | |
} |
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 | |
// authentication | |
if (!authentication()) { | |
exit; | |
} | |
$filepath = "/path/to/file"; | |
$sizes = getimagesize($filepath); | |
if (!empty($sizes['mime'])) { |
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 | |
// authentication | |
if (!authentication()) { | |
exit; | |
} | |
$filepath = "/path/to/file"; | |
$sizes = getimagesize($filepath); | |
if (!empty($sizes['mime'])) { |
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 Foo { | |
public $value = 'abc'; | |
public function __wakeup() { | |
echo(__LINE__.' '.__METHOD__).PHP_EOL; | |
} | |
public function __destruct() { | |
echo(__LINE__.' '.__METHOD__).PHP_EOL; |
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 Foo { | |
public $value = 'abc'; | |
public function __toString() { | |
echo(__METHOD__).PHP_EOL; | |
return ''; | |
} | |
} |
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 Foo { | |
public $value = 'abc'; | |
public function __destruct() { | |
echo(__METHOD__).PHP_EOL; | |
} | |
} | |
function func($text) { |