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
while;do sleep 3; printf "\r%s" $(date | awk '{print $1 $2 "_" $4 }'); done |
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 | |
date_default_timezone_set('Asia/Tokyo'); | |
$date = new DateTimeImmutable(); | |
var_dump($date->format('Y-m-d H:i:s.u')); | |
var_dump($date->format('Y-m-d H:i:s.v')); | |
$date = new DateTimeImmutable('2020-04-20 11:12:13'); | |
var_dump($date->format('U')); | |
var_dump(mktime($hour=11, $minute=12, $second=13, $month=4, $day=20, $year=2020)); | |
?> |
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 | |
$time = microtime(true); | |
register_shutdown_function( | |
function () use ($time) { | |
$time = microtime(true) - $time; | |
$format = <<<EOD | |
Memory: %s / %s MB | |
Time: %f ms | |
EOD; |
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
--TEST-- | |
mail test | |
--INI-- | |
sendmail_path=./stdout.sh | |
mail.add_x_header=off | |
mail.log=./mail.log | |
--FILE-- | |
<?php | |
# pear run-tests mailtest.phpt | |
$to = '[email protected]'; |
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 | |
$a = 0.1 + 0.1 + 0.1; | |
$b = 0.3; | |
if ($a != $b) { | |
echo "Round-off error" . PHP_EOL; | |
} | |
$a = (0.1 * 0.1) * 30; | |
$b = 0.3; | |
if ($a != $b) { |
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 | |
# php -d register_argc_argv=0 main.php | |
var_dump(ini_get("register_argc_argv")); | |
$argv = [ | |
__FILE__, | |
'-f', | |
'123', | |
]; | |
var_dump(getopt('f:')); | |
?> |
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
#!/bin/sh | |
dir_path="/path/" | |
date_str=$(date "+%Y%m%d_%H%M%S") | |
log_name="${dir_path}/${date_str}.log" | |
touch "${log_name}" | |
command 2>&1 | tee -a ${log_name}; | |
# or | |
command >> "${log_name}" 2>&1 |
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
#!/bin/sh | |
if [ `date +"%Y%m%d"` == "20200401" ]; then | |
# do something | |
: | |
fi |
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 | |
require __DIR__.'/../vendor/autoload.php'; |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<phpunit backupGlobals="false" | |
backupStaticAttributes="false" | |
beStrictAboutTestsThatDoNotTestAnything="false" | |
bootstrap="tests/bootstrap.php" | |
colors="true" | |
convertErrorsToExceptions="true" | |
convertNoticesToExceptions="true" | |
convertWarningsToExceptions="true" | |
processIsolation="false" |
NewerOlder