par
Ascla » 23 juil. 2015, 20:52
Ou alors tu peux faire un truc plus simple :
$jour_actif = "";
//echo '<strong>Jour:</strong><br><br>';
//// Lundi
$find_lundi = '<img src="http://www.site.fr/img/1_on.gif" />';
$pos = strpos($page, $find_lundi);
// Notez notre utilisation de ===. == ne fonctionnerait pas comme attendu
if ($pos === false) {
} else {
$jour_actif = $jour_actif."Lundi";
}
//// Mardi
$find_mardi = '<img src="http://www.site.fr/img/2_on.gif" />';
$pos = strpos($page, $find_mardi);
// Notez notre utilisation de ===. == ne fonctionnerait pas comme attendu
if ($pos === false) {
} else {
$jour_actif = $jour_actif.", Mardi";
}
//// Mercredi
$find_mercredi = '<img src="http://www.site.fr/img/3_on.gif" />';
$pos = strpos($page, $find_mercredi);
// Notez notre utilisation de ===. == ne fonctionnerait pas comme attendu
if ($pos === false) {
} else {
$jour_actif = $jour_actif.", Mercredi";
}
//// Jeudi
$find_jeudi = '<img src="http://www.site.fr/img/4_on.gif" />';
$pos = strpos($page, $find_jeudi);
// Notez notre utilisation de ===. == ne fonctionnerait pas comme attendu
if ($pos === false) {
} else {
$jour_actif = $jour_actif.", Jeudi";
}
//// Vendredi
$find_vendredi = '<img src="http://www.site.fr/img/5_on.gif" />';
$pos = strpos($page, $find_vendredi);
// Notez notre utilisation de ===. == ne fonctionnerait pas comme attendu
// car la position de 'a' est la 0-ième (premier) caractère.
if ($pos === false) {
} else {
$jour_actif = $jour_actif.", Vendredi";
}
//// Samedi
$find_samedi = '<img src="http://www.site.fr/img/6_on.gif" />';
$pos = strpos($page, $find_samedi);
// Notez notre utilisation de ===. == ne fonctionnerait pas comme attendu
// car la position de 'a' est la 0-ième (premier) caractère.
if ($pos === false) {
} else {
$jour_actif = $jour_actif.", Samedi";
}
//// Dimanche
$find_dimanche = '<img src="http://www.site.fr/img/7_on.gif" />';
$pos = strpos($page, $find_dimanche);
// Notez notre utilisation de ===. == ne fonctionnerait pas comme attendu
// car la position de 'a' est la 0-ième (premier) caractère.
if ($pos === false) {
} else {
$jour_actif = $jour_actif.", Dimanche";
}
echo $jour_actif;
C'est vrai qu'il y a plus propre comme code, mais les choses les plus simples sont souvent les meilleurs.
Ou alors tu peux faire un truc plus simple :
[php]$jour_actif = "";
//echo '<strong>Jour:</strong><br><br>';
//// Lundi
$find_lundi = '<img src="http://www.site.fr/img/1_on.gif" />';
$pos = strpos($page, $find_lundi);
// Notez notre utilisation de ===. == ne fonctionnerait pas comme attendu
if ($pos === false) {
} else {
$jour_actif = $jour_actif."Lundi";
}
//// Mardi
$find_mardi = '<img src="http://www.site.fr/img/2_on.gif" />';
$pos = strpos($page, $find_mardi);
// Notez notre utilisation de ===. == ne fonctionnerait pas comme attendu
if ($pos === false) {
} else {
$jour_actif = $jour_actif.", Mardi";
}
//// Mercredi
$find_mercredi = '<img src="http://www.site.fr/img/3_on.gif" />';
$pos = strpos($page, $find_mercredi);
// Notez notre utilisation de ===. == ne fonctionnerait pas comme attendu
if ($pos === false) {
} else {
$jour_actif = $jour_actif.", Mercredi";
}
//// Jeudi
$find_jeudi = '<img src="http://www.site.fr/img/4_on.gif" />';
$pos = strpos($page, $find_jeudi);
// Notez notre utilisation de ===. == ne fonctionnerait pas comme attendu
if ($pos === false) {
} else {
$jour_actif = $jour_actif.", Jeudi";
}
//// Vendredi
$find_vendredi = '<img src="http://www.site.fr/img/5_on.gif" />';
$pos = strpos($page, $find_vendredi);
// Notez notre utilisation de ===. == ne fonctionnerait pas comme attendu
// car la position de 'a' est la 0-ième (premier) caractère.
if ($pos === false) {
} else {
$jour_actif = $jour_actif.", Vendredi";
}
//// Samedi
$find_samedi = '<img src="http://www.site.fr/img/6_on.gif" />';
$pos = strpos($page, $find_samedi);
// Notez notre utilisation de ===. == ne fonctionnerait pas comme attendu
// car la position de 'a' est la 0-ième (premier) caractère.
if ($pos === false) {
} else {
$jour_actif = $jour_actif.", Samedi";
}
//// Dimanche
$find_dimanche = '<img src="http://www.site.fr/img/7_on.gif" />';
$pos = strpos($page, $find_dimanche);
// Notez notre utilisation de ===. == ne fonctionnerait pas comme attendu
// car la position de 'a' est la 0-ième (premier) caractère.
if ($pos === false) {
} else {
$jour_actif = $jour_actif.", Dimanche";
}
echo $jour_actif;[/php]
C'est vrai qu'il y a plus propre comme code, mais les choses les plus simples sont souvent les meilleurs.