par
sirakawa » 17 juin 2011, 16:07
Une idée qui retourne un tableau de tous les verbes, verbe par verbe
<?PHP
function traite ($liste)
{
$tab1 = array();
$i=1;
foreach($liste as $tab)
{
if (is_array($tab)):
$tab1[$i]['infinitif'] = $tab[0]; //verbe 1 etc..
$tab1[$i++]['indic pr 1 s'] = $tab[1];
endif;
}
return $tab1;
}
$liste = array
(
array
(
"aimer", "aime", "aimons", "aiment"
),
array
(
"boire", "bois", "buvons", "boivent"
)
);
$tab_final= traite ($liste);
print_r($tab_final);
?>
et le même avec lecture verticale (tous les infinitifs, tous les indicatifs...
<?PHP
function traite ($liste)
{
$tab1 = array();
$i=1;
foreach($liste as $tab)
{
if (is_array($tab)):
$tab1['un'][] = $tab[0]; //verbe 1 etc..
$tab1['deux'][] = $tab[1];
endif;
}
return $tab1;
}
$liste = array
(
array
(
"aimer", "aime", "aimons", "aiment"
),
array
(
"boire", "bois", "buvons", "boivent"
)
);
$tab_final= traite ($liste);
print_r($tab_final);
?>
Une idée qui retourne un tableau de tous les verbes, verbe par verbe
<?PHP
function traite ($liste)
{
$tab1 = array();
$i=1;
foreach($liste as $tab)
{
if (is_array($tab)):
$tab1[$i]['infinitif'] = $tab[0]; //verbe 1 etc..
$tab1[$i++]['indic pr 1 s'] = $tab[1];
endif;
}
return $tab1;
}
$liste = array
(
array
(
"aimer", "aime", "aimons", "aiment"
),
array
(
"boire", "bois", "buvons", "boivent"
)
);
$tab_final= traite ($liste);
print_r($tab_final);
?>
et le même avec lecture verticale (tous les infinitifs, tous les indicatifs...
<?PHP
function traite ($liste)
{
$tab1 = array();
$i=1;
foreach($liste as $tab)
{
if (is_array($tab)):
$tab1['un'][] = $tab[0]; //verbe 1 etc..
$tab1['deux'][] = $tab[1];
endif;
}
return $tab1;
}
$liste = array
(
array
(
"aimer", "aime", "aimons", "aiment"
),
array
(
"boire", "bois", "buvons", "boivent"
)
);
$tab_final= traite ($liste);
print_r($tab_final);
?>