Skip to content

Instantly share code, notes, and snippets.

@je8n
Created January 18, 2019 16:59
Show Gist options
  • Save je8n/71bfa45eaa7a887232315aa0da59df20 to your computer and use it in GitHub Desktop.
Save je8n/71bfa45eaa7a887232315aa0da59df20 to your computer and use it in GitHub Desktop.
jsonaddModel.php
<?php
class jsonaddModel
{
private $arr;
public function __construct(){
$this->arr=[];
}
public function add($key,$value){
$tmp=$this->arr;
if(is_array($value)){
foreach($value as $keyx=>$val)$value=$val;
}
$this->arr[]=array("id" => $key,"value"=> $value);
}
public function get(){
$arr=$this->arr;
return $arr;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment