アウトプットができる技術者に

it's a time to take a new step !

PHP

php printf

PHP

printf("%04d", 900); # => 0900 4桁

php 日付の形式をゼロ詰めする

PHP

$ymd = "2013-04-5"; $fmt_ymd = date("Y-m-d", strtotime($ymd)); print_r($fmt_ymd); -> "2013-04-05"

Web上のデータを保存する

PHP

画像とかPDFとかをWeb上から直接取得する方法。 1行で完結します。 file_put_contents($name, file_get_contents($image_url));

php 月末・月初の出力方法

PHP

備忘録デス。 // 今月の月初 echo date("Y-m-01", time()); // 今月の月末 echo date("Y-m-t", time()); // 前月の月初 echo date("Y-m-01",strtotime("-1 month")); // 前月の月末 echo date("Y-m-t",strtotime("-1 month"));