Skip to content

Instantly share code, notes, and snippets.

@bkmorse
Created March 24, 2014 20:01
Show Gist options
  • Select an option

  • Save bkmorse/9747849 to your computer and use it in GitHub Desktop.

Select an option

Save bkmorse/9747849 to your computer and use it in GitHub Desktop.
Array
(
[0] => Array
(
[event_id] => 247093
[date_schedule] => 2014-05-14T02:30:00
[city] => San Diego
[venue] => Humphreys Concerts by the Bay
[buy_link] => http://www.axs.com/events/247093/lindsey-stirling-with-dia-frampton-tickets
),
[1] => Array
(
[event_id] => 247094
[date_schedule] => 2014-05-14T02:30:00
[city] => San Diego
[venue] => Humphreys Concerts by the Bay
[buy_link] => http://www.axs.com/events/247093/lindsey-stirling-with-dia-frampton-tickets
),
[2] => Array
(
[event_id] => 247095
[date_schedule] => 2014-05-14T02:30:00
[city] => San Diego
[venue] => Humphreys Concerts by the Bay
[buy_link] => http://www.axs.com/events/247093/lindsey-stirling-with-dia-frampton-tickets
)
)
// to
Array
(
[247093] => Array
(
[event_id] => 247093
[date_schedule] => 2014-05-14T02:30:00
[city] => San Diego
[venue] => Humphreys Concerts by the Bay
[buy_link] => http://www.axs.com/events/247093/lindsey-stirling-with-dia-frampton-tickets
)
[247094] => Array
(
[event_id] => 247093
[date_schedule] => 2014-05-14T02:30:00
[city] => San Diego
[venue] => Humphreys Concerts by the Bay
[buy_link] => http://www.axs.com/events/247093/lindsey-stirling-with-dia-frampton-tickets
)
[247095] => Array
(
[event_id] => 247093
[date_schedule] => 2014-05-14T02:30:00
[city] => San Diego
[venue] => Humphreys Concerts by the Bay
[buy_link] => http://www.axs.com/events/247093/lindsey-stirling-with-dia-frampton-tickets
)
)
@Tim-Machine
Copy link
Copy Markdown

<?php 
$newArray = array();

for($i= 0 , $i <= count($array), $i++){
$newArray[$array[$i]['event_id']] = $array[$i];
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment