Ask a Question related to PHP Development, Design and Development.
-
Marco Snoek #1
Multi-dimensional Array
Hi,
Array-Question:
Suppose you have an array like:
<?
$invoices[$invoicenumber][taxrate.$taxrate]=$taxrate;
$invoices[$invoicenumber][turnover.$taxrate]=a number;
?>
Now:
<?
while(list($key,$val)=each($invoces[xxxxx)) {
echo "$key - $val";
}
?>
shows a neat list..
Now,
Is there a possibility to access an item of this array direct?
e.g. suppose you have diffrent tax-rates, and want to know the value of:
$invoices[$invoicenumber][taxrate.$taxrate] if you have the
invoicenumber???
echo $invoices[12345][0]; (the first item of the array-stack)
returns: Array[0]
and suppose taxrate=6:
echo $invoices[12345][turnover6]; returns: Array[turnover6]
Somebody knows how to get the value(s) of this without the loop?
Thanx in advance,
Marco Snoek
Marco Snoek Guest
-
Filtering the elements of a multi-dimensional array
I would like to be able to filter every element of a multi-dimensional array using htmlspecialchars() and to retain the structure of the array. I... -
assigning a multi-dimensional array (mda) to an mda?
Hi all, Quiet but not idle... I'm working on localization -- placing all text labels, etc. into one subsection; this made things so easy I... -
#24620 [Bgs]: Error multi dimensional array
ID: 24620 User updated by: fadfdsj at libero dot it Reported By: fadfdsj at libero dot it Status: Bogus Bug Type: ... -
#24620 [Opn->Bgs]: Error multi dimensional array
ID: 24620 Updated by: sniper@php.net Reported By: fadfdsj at libero dot it -Status: Open +Status: ... -
#24620 [Opn]: Error multi dimensional array
ID: 24620 User updated by: fadfdsj at libero dot it Reported By: fadfdsj at libero dot it Status: Open Bug Type: ... -
point #2
Re: Multi-dimensional Array
If I understand you might need array_values() function....
Check the manual....
hope this helps....
"Marco Snoek" <[mps]@DONT _
YOU^DARE%SEND/SPAM!!!@remove/this[@webmind.nl]@remove/this> wrote in message
news:3f70021b$0$58712$e4fe514c@news.xs4all.nl...> Hi,
>
> Array-Question:
>
> Suppose you have an array like:
> <?
> $invoices[$invoicenumber][taxrate.$taxrate]=$taxrate;
> $invoices[$invoicenumber][turnover.$taxrate]=a number;
> ?>
>
>
> Now:
> <?
> while(list($key,$val)=each($invoces[xxxxx)) {
> echo "$key - $val";
> }
> ?>
> shows a neat list..
>
> Now,
> Is there a possibility to access an item of this array direct?
> e.g. suppose you have diffrent tax-rates, and want to know the value of:
> $invoices[$invoicenumber][taxrate.$taxrate] if you have the
> invoicenumber???
> echo $invoices[12345][0]; (the first item of the array-stack)
> returns: Array[0]
>
> and suppose taxrate=6:
> echo $invoices[12345][turnover6]; returns: Array[turnover6]
>
> Somebody knows how to get the value(s) of this without the loop?
>
> Thanx in advance,
>
> Marco Snoek
>
>
point Guest
-
Marco Snoek #3
Re: Multi-dimensional Array ==> solved
I found a work-around with
$needed = array_key(array_slice($invoces[$invocenumber],3,5));
(by head.. typo???)
But more problems appear, so I put it aside.. :-)
Thanx anyway :-)))
"point" <point@caanNOproductionSPAM.com> schreef in bericht
news:bkq0gd01cit@enews3.newsguy.com...message> If I understand you might need array_values() function....
>
> Check the manual....
>
> hope this helps....
>
> "Marco Snoek" <[mps]@DONT _
> YOU^DARE%SEND/SPAM!!!@remove/this[@webmind.nl]@remove/this> wrote inof:> news:3f70021b$0$58712$e4fe514c@news.xs4all.nl...> > Hi,
> >
> > Array-Question:
> >
> > Suppose you have an array like:
> > <?
> > $invoices[$invoicenumber][taxrate.$taxrate]=$taxrate;
> > $invoices[$invoicenumber][turnover.$taxrate]=a number;
> > ?>
> >
> >
> > Now:
> > <?
> > while(list($key,$val)=each($invoces[xxxxx)) {
> > echo "$key - $val";
> > }
> > ?>
> > shows a neat list..
> >
> > Now,
> > Is there a possibility to access an item of this array direct?
> > e.g. suppose you have diffrent tax-rates, and want to know the value>> > $invoices[$invoicenumber][taxrate.$taxrate] if you have the
> > invoicenumber???
> > echo $invoices[12345][0]; (the first item of the array-stack)
> > returns: Array[0]
> >
> > and suppose taxrate=6:
> > echo $invoices[12345][turnover6]; returns: Array[turnover6]
> >
> > Somebody knows how to get the value(s) of this without the loop?
> >
> > Thanx in advance,
> >
> > Marco Snoek
> >
> >
>
Marco Snoek Guest



Reply With Quote

