- print_r: documentation ( source)
- date: documentation ( source)
- strtotime: documentation ( source)
<?php
$da = array("sunday","thursday","saturday");
$a = '';
for ( $i =0; $i< sizeof($da); $i++){
if ( $da[0] == 'sunday' && sizeof($da) > 1 && (strtotime('today') != strtotime($da[0])) ){
continue;
}
if ( strtotime($da[$i]) >= strtotime("today") ){
$a = strtotime($da[$i]);
if (isset($a)){
break;
}
}
}
print_r(date('Y-m-d',$a));
?>