473,385 Members | 1,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

how can i extract the values from an array

Hi

Am a new bie - and in need of some helo
Please find the attachment here.
I would like to know how I can extract the values from this and list properly?

What I need is to list the Hotel ID, Name ,etc .

Can any one help me?

Many thanks
Sathish
Attached Files
File Type: txt arrays.txt (38.2 KB, 449 views)
Jan 7 '10 #1
5 1690
Markus
6,050 Expert 4TB
Is that a PHP array or will you be having to read the data from a text file?
Jan 7 '10 #2
that looks like a var_dump - if so you will need to loop through the array. It is a multi-level array, so something like this:

Expand|Select|Wrap|Line Numbers
  1. /**
  2. * loops through array/multi-dimensional arrays
  3. *@param array array to loop through
  4. *@return string in key value pairs, or null
  5. *@see http://www.communitymx.com/content/a...ge=2&cid=7CD16
  6. **/
  7. function loopThroughArray($passedArray) 
  8. {  
  9.      $retVal = '';
  10.      //validate is array
  11.      if (!is_array($passedArray) { return null; }
  12.      //loop through array
  13.       foreach ($passedArrayas $key => $value ) 
  14.       {  
  15.          if (!is_array($value)) 
  16.          {  
  17.                  // if it isn't an array show $key and $value  
  18.                  $retVal .= ' <br />' . $key; 
  19.                  $retVal .= '  ->  ' . $value; 
  20.          }
  21.           else 
  22.           { 
  23.                 // if it is an array set up the key 
  24.                $retVal .= '<hr color="red">‘ . $key.’</strong>‘;  
  25.                 //then process $value again will same function. 
  26.                  foreach_loop($value);  
  27.          }  
  28.     }
  29.      return $retVal;
  30.  }
Jan 7 '10 #3
Hi

this comes in as a string, more like a webservice. I am not sure how to explain it. I hop this helps?
Jan 8 '10 #4
I got some idea from this. Thanks a lot Erayfield!
I think I will give a try using this and the link You have mentioned.

:)
Jan 8 '10 #5
Markus
6,050 Expert 4TB
The data you posted is in the same format as provided by the web service? If so I'd tell the web service provider that they need to seriously reconsider.
Jan 8 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: jason | last post by:
Access 2000 I need some help interogatting a table and extracting via ASP the final field in a row which has a value. In other words, I have a maximum of 10 fields but, at the user level he may...
1
by: smurf | last post by:
Seems a simple question, but I can't find a simple answer: I have created a two dimensional array. I wish to send the data, a row at a time to a graph plotting routine which is expected a one...
6
by: Mohammad-Reza | last post by:
Hi I want to extract icon of an exe file and want to know how. I look at the MSDN and find out that I can use ExtractIconEx() Windows API but in there are some changes to that api in c# I made...
3
by: zek2005 | last post by:
Hi friends! I have a varchar field in my DB with numeric values separates by spaces. I need to extract the numbers to create an array. Example 1: 1820 1823 1825 --> need to be transform into ...
8
by: Fabian Braennstroem | last post by:
Hi, I would like to remove certain lines from a log files. I had some sed/awk scripts for this, but now, I want to use python with its re module for this task. Actually, I have two different...
3
by: roopa.v1 | last post by:
Hi, How to assign long to character array and later extract it
1
by: macupryk | last post by:
soapclient. need to extract information in php from a webservice that was built in C# asp.net 2.0 I am new to php. Can someone help me with the code below. I would like to learn how to manipulate...
5
by: =?Utf-8?B?aWxy?= | last post by:
Hi This is probably fairly simple but I am newish at programming and was wondering if someone can give me some advice on handling the following. I have an array with a large number of elements...
10
by: Gilles Ganault | last post by:
Hello Out of curiosity, is there a smarter, easier way to read data sent by a form, and save them into a database? I have about 20 fields, and it'd be easier if I could just use a loop to go...
3
bilibytes
by: bilibytes | last post by:
Hi everyone, I am wondering if it is possible to extract the key values of an array into object variables. lets say i have the following $_REQUEST array: $var_array = array("color" =>...
1
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.