3v4l.org

run code in 300+ PHP versions simultaneously
<?php function add_date($givendate,$day=0,$mth=0,$yr=0) { $cd = strtotime($givendate); $newdate = date('Y-m-d h:i:s', mktime(date('h',$cd), date('i',$cd), date('s',$cd), date('m',$cd)+$mth, date('d',$cd)+$day, date('Y',$cd)+$yr)); return $newdate; } print $current_month_first=date("Y").'-'.date("m").'-'.'01'; print ',,,'.$current_month_first_stamp=strtotime($current_month_first); $kezdonapszam="21"; $kezdonapszam_int= (int) $kezdonapszam; $kezdonapszam_int=$kezdonapszam_int-1; $kezdo_full=add_date($current_month_first, $kezdonapszam_int); print '...'.strtotime($kezdo_full); if (strtotime($kezdo_full)<strtotime($date())) {$kezdo_full=add_date($kezdo_full,0,1);} print '...'.$kezdo_full; //print date("Y-m-d",$kezdo_full);

preferences:
45.72 ms | 402 KiB | 5 Q