From ac3edc643936fc089bdd7ad50103b784563a149c Mon Sep 17 00:00:00 2001 From: mayur31031996 <44286710+mayur31031996@users.noreply.github.com> Date: Sun, 21 Oct 2018 12:52:30 +0530 Subject: [PATCH] Task completed --- JSON-Operation/index.html | 27 +++++++++++++ JSON-Operation/index1.php | 85 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 JSON-Operation/index.html create mode 100644 JSON-Operation/index1.php diff --git a/JSON-Operation/index.html b/JSON-Operation/index.html new file mode 100644 index 0000000..d3acfd3 --- /dev/null +++ b/JSON-Operation/index.html @@ -0,0 +1,27 @@ + + + TodoTask + + +
+ Find Last Name :
+

+ Find balance in INR :
+

+ Find tag count :
+

+ Split adress into Strret, City, State & Pincode. :
+

+ Find email domain :
+

+ Create sublist accourding to favoriteFruit. :
+

+ Find registered ago ex. If registered in 2015-03-01 than output should be 3 years 7 months 17 days :
+

+ Find Friends count with oldest friend name :
+

+ + +
+ + \ No newline at end of file diff --git a/JSON-Operation/index1.php b/JSON-Operation/index1.php new file mode 100644 index 0000000..797e7a0 --- /dev/null +++ b/JSON-Operation/index1.php @@ -0,0 +1,85 @@ +'; + echo "City :" .$str_arr[1].'
'; + echo "State :" .$str_arr[2].'
'; + echo "Pincode :" .$str_arr[3].'
'; + echo "New Address
"; + echo "================
"; + } +}elseif($_GET['fruit']!=null){ + for($i=0;$i<=$elementCount;$i++){ + if($data[$i]['favoriteFruit']==$_GET['fruit']){ + echo "favoriteFruit : ".$data[$i]['favoriteFruit']; + break; + } + else{ + echo "data not found"; + break; + } + } +} +elseif($_GET['dates']!=null){ + $date1 = $_GET['dates']; + $date2 = date("Y/m/d"); + + $diff = abs(strtotime($date2) - strtotime($date1)); + + $years = floor($diff / (365*60*60*24)); + $months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); + $days = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); + + printf("%d years, %d months, %d days\n", $years, $months, $days); + }elseif($_GET['name1']!=null){ + for($i=0;$i<=$elementCount;$i++){ + if($data[$i]['name']==$_GET['name1']){ + $maxval= max($data[$i]['friends'][0]['age'],$data[$i]['friends'][1]['age'],$data[$i]['friends'][2]['age']); + for($j=0;$j<=count($data[$i]['friends']);$j++){ + if($data[$i]['friends'][$j]['age']==$maxval){ + echo "oldest Friend : ".$data[$i]['friends'][$j]['name']; + break; + } + } + break; + } + + } + } +else{ + echo "data????"; +} +?> \ No newline at end of file