hi all,
have a simple problem,
my array is :-
$c = array(
"2" =array(
"id" ="2",
"name" ="Sport",
"children" =array(
"4" =array(
"id" ="4",
"name" =>
"Archery",
"children" =>
"",
),
"5" =array(
"id" ="5",
"name" =>
"Badminton",
"children" =>
"",
),
),
),
);
and i want to convert this to
$options = array(
'Sports' =>array(
'3' ='Archery',
'4' ='Badminton',
),
);
Where 3 & 4 are the keys foe Archey & Badminton resp.
I am a newbie to PHP
getting so many problems solving this,
Any help appriciated. 5 1416
On 30 Jul, 16:14, 1956col <prash.ma...@gmail.comwrote:
hi all,
have a simple problem,
my array is :-
$c = array(
"2" =array(
"id" ="2",
"name" ="Sport",
"children" =array(
"4" =array(
"id" ="4",
"name" =>
"Archery",
"children" =>
"",
),
"5" =array(
"id" ="5",
"name" =>
"Badminton",
"children" =>
"",
),
),
),
);
and i want to convert this to
$options = array(
'Sports' =>array(
'3' ='Archery',
'4' ='Badminton',
),
);
Where 3 & 4 are the keys foe Archey & Badminton resp.
I am a newbie to PHP
getting so many problems solving this,
Any help appriciated.
Is your rule for converting the "id" value to the new keys
array key = id value - 1
On Jul 30, 11:14 am, 1956col <prash.ma...@gmail.comwrote:
hi all,
have a simple problem,
my array is :-
$c = array(
"2" =array(
"id" ="2",
"name" ="Sport",
"children" =array(
"4" =array(
"id" ="4",
"name" =>
"Archery",
"children" =>
"",
),
"5" =array(
"id" ="5",
"name" =>
"Badminton",
"children" =>
"",
),
),
),
);
and i want to convert this to
$options = array(
'Sports' =>array(
'3' ='Archery',
'4' ='Badminton',
),
);
Where 3 & 4 are the keys foe Archey & Badminton resp.
I am a newbie to PHP
getting so many problems solving this,
Any help appriciated.
something like this...
$options = array();
$kids = array();
foreach ($c as $cc) {
foreach ($cc['children'] as $key =$value) {
$k = $key - 1;
$kids[] = array($k =$value);
array_push($cc['name'] =$kids);
}
}
it depends on the bigger picture of your data and how it's formatted.
On Mon, 30 Jul 2007 17:14:47 +0200, 1956col <pr*********@gmail.comwrote:
hi all,
have a simple problem,
<snip>
Please don't multipost, I see you've got answers in different groups, save
people the trouble answering something that is allready answered.
--
Rik Wasmus
On Jul 31, 5:11 am, Rik <luiheidsgoe...@hotmail.comwrote:
On Mon, 30 Jul 2007 17:14:47 +0200, 1956col <prash.ma...@gmail.comwrote:
hi all,
have a simple problem,
<snip>
Please don't multipost, I see you've got answers in different groups, save
people the trouble answering something that is allready answered.
--
Rik Wasmus
Thabks for that one ELINTPimp
good solution ,
but i tried foreach inside foreach and its working absolutly fine,
thanks once again
On Jul 31, 5:11 am, Rik <luiheidsgoe...@hotmail.comwrote:
On Mon, 30 Jul 2007 17:14:47 +0200, 1956col <prash.ma...@gmail.comwrote:
hi all,
have a simple problem,
<snip>
Please don't multipost, I see you've got answers in different groups, save
people the trouble answering something that is allready answered.
--
Rik Wasmus
yup
sory for that ,
i m a newbie .
won't happen next time. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: N |
last post by:
Hi,
I would like to parse out each value that is seperated
by a comma in a field and use that value to join to another table.
What would be the easiest way to do so without having to
write a...
|
by: iop |
last post by:
Hello there,
I'd like to "parse" an entire multi-dimension array like this :
APP
APP
without knowing "framework" or "config" or anything passed as variables...
'cause it's simple to call...
|
by: M.B. |
last post by:
Hi
I'm currently converting an application from Java to C#, and in this
application I need to read a C# source file, extract some information
and then write a modified version of the original...
|
by: Jeannie |
last post by:
Hello group!
I'm in Europe, traveling with my laptop, and I don't any compilers
other than Borland C++ 5.5. available. I also don't have any manuals
or help files available. Sadly, more...
|
by: QQ |
last post by:
Hello I have a string like this
"213200","0000","9999","204-033-105"
but I need to seperate them to be
s1 = 213200;
s2 = 0000;
s3 = 9999;
s4 = 204-033-105;
Is there any good way to do it?
|
by: tony collier |
last post by:
I have
.....
enum day {monday, tuesday, wednesday};
myArray=5;
i=(int)Enum.Parse(typeof(day), wednesday);
|
by: William Stacey [MVP] |
last post by:
Anyone know of some library that will parse files like following:
options {
directory "/etc";
allow-query { any; }; // This is the default
recursion no;
listen-on { 192.168.0.225;...
|
by: BMeyer |
last post by:
I have been losing my mind trying to parse an XML document (with nested child
elements, not all of which appear in each parent node) into a DataGrid
object. What I want to do is "flatten" the XML...
|
by: bobc |
last post by:
In my stored procedure, I want to parse @ArrayOfDays into @d1 through
@d5.
@ArrayOfDays is a varchar input parameter containing,
for example, "1.7.21.25.60." - five elements.
Most active...
|
by: lancewassing |
last post by:
I'm hoping this question is simple. I am trying to create a login script for my already in place client manage using php. I have created a text file filled with usernames and passwords delimited by...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |