info:myphp:array

Ceci est une ancienne révision du document !


Arrays en php

highlight_menu.inc.php ex. array simple 2 dimensions

<?
include("header.inc.php");

$total=0;
$myFile=fopen("array.csv","r");
    while(!feof($myFile)) {
        $data=fgetcsv($myFile,100,';');
    $link="$data[1]";
$total+=$link;
        }
fclose($myFile);

?>

<p class=titrerouge>Analyse bàl webmaster@unige.ch</p>

<table><tr><td class=titrenoir>&nbsp;9.7.03&nbsp;</td></tr>
</table>

<table border=0>
<?
echo "<tr BGCOLOR=yellow><td>Libellé</td><td align=right>Hits</td><td align=right>%</td></tr>";
#$total=0;
$i=1;
$myFile=fopen("array.csv","r");
    while(!feof($myFile)) {
        $data=fgetcsv($myFile,100,';');
        $num=count($data);
    $link="$data[1]";
$texte="$data[0]";
    $pc=intval(100*($link/$total));
if (intval($i/2)==($i/2)) {
echo "<tr BGCOLOR='#EEEEEE'>";
} else {
echo "<tr BGCOLOR='#FFFFFF'>";
}

    echo "<td align=left>$texte</td><td align=right>$link</td><td align=right>$pc</td></tr>\n";
$i++;
        }
fclose($myFile);


echo "<tr BGCOLOR=yellow><td>Total</td><td align=right>$total</td><td>100 %</td></tr></table>";

include("footer.inc.php");
?> 
  • info/myphp/array.1524754600.txt.gz
  • Dernière modification : 2018/04/26 16:56
  • de radeff