Skip to content

Instantly share code, notes, and snippets.

@akshaybabloo
Created September 9, 2016 12:47
Show Gist options
  • Save akshaybabloo/869aa534318048c52ff19dfd589df860 to your computer and use it in GitHub Desktop.
Save akshaybabloo/869aa534318048c52ff19dfd589df860 to your computer and use it in GitHub Desktop.
<?php
$json = '{"experience": {
"1": [
{"title": "Jr. Systems Engineer"},
{"company": "Cheminnova Group of Companies."},
{"where": "Hyderabad, India"},
{"from": "May, 2012"},
{"to": "February, 2013"},
{"current": false}
],
"2": [
{"title": "Research Assistant"},
{"company": "Knowledge Engineering and Discovery Research Institute (KEDRI), AUT University."},
{"where": "Auckland, New Zealand"},
{"from": "July, 2015"},
{"to": "December, 2015"},
{"current": false}
],
"3": [
{"title": "Technical Support"},
{"company": "Knowledge Engineering and Discovery Research Institute (KEDRI), AUT University."},
{"where": "Auckland, New Zealand"},
{"from": "2015"},
{"to": "Present"},
{"current": true}
],
"4": [
{"title": "Research Assistant"},
{"company": "Knowledge Engineering and Discovery Research Institute (KEDRI), AUT University."},
{"where": "Auckland, New Zealand"},
{"from": "April, 2016"},
{"to": "Present"},
{"current": true}
],
"5": [
{"title": "Teaching Assistant"},
{"company": "Computer and Mathematical Sciences , AUT University."},
{"where": "Auckland, New Zealand"},
{"from": "July, 2016"},
{"to": "Present"},
{"current": true}
]}'
$results = json_decode($json);
foreach ($results->experience as $row => $cont1) {
foreach ($cont1 as $cont => $val1) {
foreach ($val1 as $key => $val) {
if ($val == 1) {
echo "hello";
echo '<br>';
}
if ($key == "from") {
echo $val;
echo '<br>';
}
if ($key == "to") {
echo $val;
echo '<br>';
}
if ($key == "current")
break 1;
if ($key == "from")
break 1;
if ($key == "to")
break 1;
echo $key . ': ' . $val;
echo '<br>';
}
}
echo '<br>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment