[ create a new paste ] login | about

Link: http://codepad.org/HesEO4uF    [ raw code | output | fork ]

PHP, pasted on May 5:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php
$data = array(
    array("SchoolName" => "Roy", "StudentId" => "1000,1001,1002"),
    array("SchoolName" => "MIT", "StudentId" => "2000,2001,2002"),
    array("SchoolName" => "Southwestern College", "StudentId" => "3000,3001,3002"),
    array("SchoolName" => "National University", "StudentId" => "4000,4001,4002"),
    array("SchoolName" => "Western Governors University", "StudentId" => "5000,5001,5002"),
);

$return = array();

foreach($data as $rs){
    $return[$rs['SchoolName']] = $rs['StudentId'];
}

print_r($return);


Output:
1
2
3
4
5
6
7
8
Array
(
    [Roy] => 1000,1001,1002
    [MIT] => 2000,2001,2002
    [Southwestern College] => 3000,3001,3002
    [National University] => 4000,4001,4002
    [Western Governors University] => 5000,5001,5002
)


Create a new paste based on this one


Comments: