※日本郵政の事例には対応していません。(正規表現のお勉強)
(例)郵便番号「2260027」 番地「9-7-6-a-1-c」
22600279-7-6-a-1-c
22600279-7-6A1C
2.gif/2.gif/6.gif/0.gif/0.gif/2.gif/7.gif/9.gif/-.gif/7.gif/-.gif/6.gif/c1.gif/0.gif/1.gif/c1.gif/2.gif
17

128
チェックデジット:5

(例)郵便番号「2260027」 番地「2-34-6」 建物名「中央街区B棟1912」
22600272-34-6-中央街区B棟1912
22600272-34-6B1912
2.gif/2.gif/6.gif/0.gif/0.gif/2.gif/7.gif/2.gif/-.gif/3.gif/4.gif/-.gif/6.gif/c1.gif/1.gif/1.gif/9.gif/1.gif/2.gif
19

93
チェックデジット:2
23
└郵便番号┘└───番地───┘└─────建物名─────┘





4-36

朝日生命横浜本町ビル8F
朝日生命横浜本町ビル8F

神奈川SR経営労務センター

FPDIでPDFを読み込ませる
「ファイル」→「名前を付けて保存」→「サイズが縮小された」→「互換性を確保」→「acrobat5.0」
PHP7.0~以降のFPDI 変更点
fpdf_tpl.php(275行目)Version 1.4.4
(変更前)public function SetFont($family, $style = '', $size = 0, $size = 0, $fontfile = '', $subset = 'default', $out = true)
(変更後)public function SetFont($family, $style = '', $size = 0, $fontfile = '', $subset = 'default', $out = true)
PHP7以降、関数重複はエラーになる・・・

データベース
改元日 元号 西暦変換
1912年07月30日 大正 1911
1926年12月25日 昭和 1925
1989年01月08日 平成 1988
2019年05月01日 令和 2018

年(昇順)for($i = 1934;$i < = 2009;$i++){

年(降順)for($i = 2009;$i > = 1934;$i--){

元号配列

function gengo($year){

$gengo[2019] = "令和";

$gengo[1988] = "平成";

$gengo[1925] = "昭和";

$gengo[1911] = "大正";

$gengo[1867] = "明治";

foreach( $gengo as $key => $value) {

if ($year > $key) {

return $value.($year - $key)."年";

}

}

return 0;

}




PHP7.2.34で運用中

class PDF extends FPDI {

var $_tplIdx;

function Header(){

$this->setSourceFile("file_name.pdf");

if (is_null($this->_tplIdx)) {

$this->tplIdx = $this->importPage(1);

}elseif($this->_tplIdx == $this->importPage(1)){

$this->tplIdx = $this->importPage(2);

}else{

$this->tplIdx = $this->importPage(1);

}

$this->useTemplate($this->tplIdx);

}

function Footer() {}

}



tableのAUTO_INCREMENT 取得方法
SELECT `AUTO_INCREMENT` FROM information_schema.TABLES WHERE TABLE_SCHEMA = "databaseName" AND TABLE_NAME = "tableName"
$row['AUTO_INCREMENT'];
 
パスワード消去
$str="【パスワード】qwer1234"; 
$ptn="/[0-9a-z]/"; 
$replace="$1"; 
preg_replace($ptn,$replace,$str)="【パスワード】" 
 
パスワード非表示
$str="【メールアドレス】JZD01004@nifty.com
【パスワード】qwer1234
【事務所名】丹羽労務管理事務所"; 
$ptn="/(【パスワード】)[0-9a-z]{8}/"; 
$replace="$1********"; 
preg_replace($ptn,$replace,$str)="【メールアドレス】JZD01004@nifty.com
【パスワード】********
【事務所名】丹羽労務管理事務所" 
$str="qw/er_1234"; 
$ptn="/^[[:graph:]|[:space:]]{8,}$/i"; 
preg_match($ptn,$str,$matches)="1" 
Array" 
preg_replace($ptn,$replace,$str)="**********" 
 
介護保険料徴収
2024-03-28 
誕生日:1984-03-01以前 当月支払分より介護保険料発生 $day1=date("Y-m-d",strtotime($pay_day. "-40 year"));
誕生日:1959-03-01以前 当月より介護保険料は年金から徴収 $day2=date("Y-m-d",strtotime($pay_day. "-65 year"));
1959-03-01 < [誕生日] <= 1984-03-01
 
DateTime クラス
$date = new DateTime();
2024-03-28 
誕生日:1984-03-01以前 当月支払分より介護保険料発生 $day1=$date->modify("-40 years")->format("Y-m-d");
誕生日:1959-03-01以前 当月より介護保険料は年金から徴収 $day2=$date->modify("-25 years")->format("Y-m-d");
1959-03-01 < [誕生日] <= 1984-03-01
$dateが変化する・・・・
 
DateTimeImmutable クラス
$date = new DateTimeImmutable();
2024-03-28 
2024-03-01=$date->modify('first day of this months')->format("Y-m-d"); 文字出力
2024-02-01=$date->modify('first day of last months')->format("Y-m-d"); 文字出力
誕生日:1984-03-01以前 当月支払分より介護保険料発生 $day1=$date->modify("-40 years")->format("Y-m-d");
誕生日:1959-03-01以前 当月より介護保険料は年金から徴収 $day2=$date->modify("-65 years")->format("Y-m-d");
1959-03-01 < [誕生日] <= 1984-03-01
 
雇用保険料免除(令和2年03月31日まで)
2024-03-28 
誕生日:1960-04-01以前 4月締日分より雇用保険料免除 $day1=$date->modify("-64 years")->format("Y-m-d");
[誕生日] <= 1960-04-01
1960-04-01 
2024年03月28日 $date = new DateTimeImmutable();
2024年05月31日 $day1=$date->modify("last day of +2 months")->format("Y年m月d日");
2025年03月28日 $day2=$date->modify("next year")->format("Y年m月d日");
9月 
DateTimeImmutable に、$_SESSION変数 ($_SESSION['ondate'] = new DateTimeImmutable();)
2024年03月28日 $ondate->format("Y年m月d日")
2024年03月28日 $_SESSION['ondate']->format("Y年m月d日")
 
$time1 = new DateTimeImmutable("08:00:00");
$time2 = new DateTimeImmutable("17:00:00");
$diff=$time2->diff($time1)->format('%H:%i:%s');
09:0:0 
$diff=$time1->diff($time2)->format('%H:%i:%s');
09:0:0 
17時~9時の計算
$time1 = $time1->modify('+24 hour');
$diff=$time1->diff($time2)->format('%H:%i:%s');
15:0:0 
17:00:00 
$time2: 2024年03月28日 17:00:00 
$time1: 2024年03月29日 08:00:00 
$time1->format('t'); 日数->31 
$diff2=$time1->diff($time2)->format('%a日');
0日 
$diff2=$time1->diff($time2)->format('%d日 %H時間%i分');
0日 15時間0分 
 
Webアプリケーション:https://qiita.com/mk185/items/e914683410fd4ecaf0af
webサーバーについて:https://eng-entrance.com/java-servlet-server#Web-2 
webサーバーについて:https://www.atmarkit.co.jp/ait/articles/0910/02/news097.html