LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-13-2006, 11:43 PM   #1
bahadur
Member
 
Registered: Apr 2004
Distribution: Linux Red Hat
Posts: 141

Rep: Reputation: 15
extracting values from an array


hi,

i have a PHP array which looks like this

$result = array (id => '1' ,
URL => 'yahoo.com'
)

I have tried every bit to extract the values from the array but i have been unsuccessful.

can any one tell me how do i extract the values from the above array.

i will be using the value of the URL in a if statement.
 
Old 08-14-2006, 12:51 AM   #2
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
try:
$id = $result['id']
and
$url = $result['URL']
 
Old 08-14-2006, 01:07 AM   #3
bahadur
Member
 
Registered: Apr 2004
Distribution: Linux Red Hat
Posts: 141

Original Poster
Rep: Reputation: 15
what you suggested didnt work for me. however this did work

$ur = $URLScanQueryElementArray[0]["url"];

how can i use list() and foreach for this particular array?

here is what the array looks like

Quote:
(
[0] => Array
(
[Id] => 0
[url] => yahoo.com
)

)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
help with shell script - fill an array with values from a file delmoras Linux - General 1 07-17-2006 11:19 AM
Problem displaying Bash array values. shinobi59 Programming 3 01-17-2006 05:45 PM
rx/tx values Nauseous *BSD 1 05-26-2004 02:06 PM
How to return values into an array using awk Helene Programming 1 05-01-2004 10:05 PM
PERL: Size of an array of an Array inspleak Programming 2 03-10-2004 02:24 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration