note 59071 deleted from function.date by cece
| From: | cece@php.net | Date: | Fri, 25 Nov 2005 15:08:16 +0000 |
| Subject: | note 59071 deleted from function.date by cece | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-99084@lists.php.net to get a copy of this message | ||
Note Submitter: sromero(dot)voie.com.ar
Reason: bad code
----
Here is a little code to find the last day number of tuesday
<?php
//today in number
$dia = date("j");
/*last month in number*/
$mes = mktime(0, 0, 0, date("m")-1, date("d"), date("Y"));
/*number of day*/
$tipo = date("w");
switch ($tipo)
{
case 0:
$resula = $dia-3;
break;
case 1:
$resula = $dia-4;
break;
case 2:
$resula = $dia-5;
break;
case 3:
$resula = $dia-6;
break;
case 4:
$resula = $dia;
break;
case 5:
$resula = $dia-1;
break;
case 6:
$resula = $dia-2;
break;
}
/*comprovations*/
if ($dia < 7&& $tipo != 4){$resul = $mes+$resula;}else{$resul = $resula;}
echo $resul;
?>