Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to get the first column third data  from a two dimensional array  in php

Posted on 2013-06-07
1
Medium Priority
?
496 Views
Last Modified: 2013-06-07
Hi i have array of records. i want to get 1st column 3rd record. How i will get it by PHP? here is the array

Array
(
    [id] => 1623
    [name] => BELLEVUE HOSPITAL CENTER
    [address] => FIRST AVENUE AT 27TH STREET
    [lat_centroid] => 40.7445
    [long_centroid] => -73.9782
    [query_string] => bellevue-hospital-center
    [city_name] => New York
    [postal] => 10016
    [phone] => (212) 561-4132
}

i want to get
[lat_centroid] => 40.7445
[long_centroid] => -73.9782

How will i do ? pls help me
0
Comment
Question by:krushnac
1 Comment
 
LVL 60

Accepted Solution

by:
Julian Hansen earned 1200 total points
ID: 39228351
the samples you gave are 3rd and fourth columns

Why not just use this?

For the fields in the first record

$arrayname[0]['lat_centroid']
$arrayname[0]['long_centroid']

And the second

$arrayname[1]['lat_centroid']
$arrayname[1]['long_centroid']

etc
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question