note 86301 added to control-structures.foreach
| From: | Guille at osu1 dot php dot net | Date: | Sat, 11 Oct 2008 20:43:03 +0000 |
| Subject: | note 86301 added to control-structures.foreach | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-145280@lists.php.net to get a copy of this message | ||
I need help with my foreach loop
How do I return the value of the entire array? I used a foreach loop like this one:
<?php function Helpme()
{
global $hola;
$invoice = $_SESSION['invoice'];
$cart = $_SESSION['carrito'];
$invoice->cart = $cart;
$_SESSION['invoice'] = $invoice;
foreach ($invoice->cart->items as $id=>$item )
{
$target = array($id," ");
//print $target[0];
$hola = implode("",$target);
echo gettype($hola);
//return $hola;
}
}
Helpme();
?>
I don't get the values of the array "$id"
----
Server IP: 200.6.154.201
Probable Submitter: 200.84.91.207
----
Manual Page -- http://www.php.net/manual/en/control-structures.foreach.php
Edit -- https://master.php.net/note/edit/86301
Del: integrated -- https://master.php.net/note/delete/86301/integrated
Del: useless -- https://master.php.net/note/delete/86301/useless
Del: bad code -- https://master.php.net/note/delete/86301/bad+code
Del: spam -- https://master.php.net/note/delete/86301/spam
Del: non-english -- https://master.php.net/note/delete/86301/non-english
Del: in docs -- https://master.php.net/note/delete/86301/in+docs
Del: other reasons-- https://master.php.net/note/delete/86301
Reject -- https://master.php.net/note/reject/86301
Search -- https://master.php.net/manage/user-notes.php