[PHP] insérer une fonction dans une variable

Résolu
okuni Messages postés 1221 Date d'inscription   Statut Membre Dernière intervention   -  
okuni Messages postés 1221 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,

J'aimerais savoir s'il est possible d'insérer une fonction dans une varibale
voir mon exemple ici :
<table>
		<tr>
			<th>Nom</th>
			<th>Taille</th>
			<th>Couleur</th>
			<th>Quantité</th>
			<th>prix unitaire</th>
			<th>prix</th>
		</tr>
		' . for ($i = 0; $i < count($_SESSION['panier']['id_produit']); $i++)
		{ . '
			<tr>
				<td>'.$_SESSION['panier']['nom_produit'][$i].'</td>
				<td>'.$_SESSION['panier']['taille'][$i].'</td>
				<td>'.$_SESSION['panier']['couleur'][$i].'</td>
				<td>'.$_SESSION['panier']['quantite'][$i].'</td>
				<td>'.$_SESSION['panier']['prix'][$i].'</td>
				<td>'.$_SESSION['panier']['prix'][$i] * $_SESSION['panier']['quantite'][$i].'</td>
			</tr>
		' . } . '
	</table>

C'est la variable $message pour l'envoi d'un mail automatique.
J'aimerais donc mettre un tableau avec le nombre d'articles acheté (donc un nombre de ligne du tableau variable)
J'ai donc concaténé la fonction for dans la variable $message, mais le code bug.

Quelqu'un sait pourquoi?

Merci.
A voir également:

1 réponse

okuni Messages postés 1221 Date d'inscription   Statut Membre Dernière intervention   126
 
C'est bon, après avoir un peu chipotter, je suis arrivé a un bon résultat :p
0