消費税
とりあえず、消費税について考えました。
たぶん、もっと考えないといけないのかもしれません。
<?php function ckdj($strpw){ $yearpw = substr( $strpw, 0, 4); $monthpw = substr( $strpw, 5, 2); $daypw = substr( $strpw, 8, 2); $hourpw = 0; $minutepw = 0; $secondpw = 0; if( checkdate($monthpw, $daypw, $yearpw)){ $timestamppw = mktime ($hourpw, $minutepw, $secondpw , $monthpw , $daypw , $yearpw ); return $timestamppw; }else{ return -1; } } function zeiritsuj($strpw){ /* 1989/04/01 3% 1997/04/01 5% 2014/04/01 8% 2015/09/30 10% */ $in_timestamppw = ckdj($strpw); if( $in_timestamppw == -1 ){ echo "error-desu!!"; // die(); } if( $in_timestamppw < strtotime("1989/04/01") ){ return 0; }elseif( $in_timestamppw >= strtotime("1989/04/01") and $in_timestamppw < strtotime("1997/04/01") ){ return 0.03; }elseif( $in_timestamppw >= strtotime("1997/04/01") and $in_timestamppw < strtotime("2014/04/01") ){ return 0.05; }elseif( $in_timestamppw >= strtotime("2014/04/01") and $in_timestamppw < strtotime("2015/10/01") ){ return 0.08; }elseif( $in_timestamppw >= strtotime("2015/10/01") ){ return 0.1; } } function zeikomij($kinpw, $indatepw){ return $kinpw + ($kinpw * zeiritsuj($indatepw)); } echo "2015/10/32 ".zeiritsuj("2015/10/32")."<br>\n"; echo "1989/03/31 ".zeiritsuj("1989/03/31")."<br>\n"; echo "1989/04/01 ".zeiritsuj("1989/04/01")."<br>\n"; echo "1997/03/31 ".zeiritsuj("1997/03/31")."<br>\n"; echo "1997/04/01 ".zeiritsuj("1997/04/01")."<br>\n"; echo "2014/03/31 ".zeiritsuj("2014/03/31")."<br>\n"; echo "2014/04/01 ".zeiritsuj("2014/04/01")."<br>\n"; echo "2015/09/30 ".zeiritsuj("2015/09/30")."<br>\n"; echo "2015/10/01 ".zeiritsuj("2015/10/01")."<br>\n"; /* error-desu!!2015/10/32 0 1989/03/31 0 1989/04/01 0.03 1997/03/31 0.03 1997/04/01 0.05 2014/03/31 0.05 2014/04/01 0.08 2015/09/30 0.08 2015/10/01 0.1 */ ?>