In this tutorial learn generate an array in php from value and then convert array to JSON encode format, convert an array in php first to store value in array and then convert into JSON encode using jsonencode() funcition
OUTPUT :
[
<?php $AR = array(); for($i=1;$i<5;$i++) { $AR[] = array('date' => date("d m Y",strtotime("+".$i." days")), 'id' => $i); } echo json_encode($AR);?>
[
- date: "05 05 2019",
- id: 1
- date: "06 05 2019",
- id: 2
- date: "07 05 2019",
- id: 3
- date: "08 05 2019",
- id: 4
Nice article, very helpful for newbies....Here I also have some useful informations. Please go through
ReplyDeleteWordpress customization
WordPress Search Engine Optimization
Genesis Wordpress Theme
wordpress plugin development