Skip to content

Instantly share code, notes, and snippets.

@khatabwedaa
Created May 19, 2019 02:29
Show Gist options
  • Save khatabwedaa/3f66d5662e380977acf63e0fb272fb9b to your computer and use it in GitHub Desktop.
Save khatabwedaa/3f66d5662e380977acf63e0fb272fb9b to your computer and use it in GitHub Desktop.
<?php
$arr = [
"title: Lorem ipsum title",
"body: Lorem ipsum dolor, sit amet consectetur adipisicing elit.",
];
$items = [];
for($i=0; $i < count($arr); $i++) {
$items[$i] = explode(':' , $arr[$i]);
$associativeArrays[$items[$i][0]] = $items[$i][1];
}
var_dump($associativeArrays);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment