PHP Classes

File: php/workingWithObject.php

Recommend this page to a friend!
  Classes of bamigboye biodun   Logical Functions   php/workingWithObject.php   Download  
File: php/workingWithObject.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Logical Functions
General-purpose PHP and JavaScript functions
Author: By
Last change:
Date: 1 year ago
Size: 408 bytes
 

Contents

Class file image Download
<?php
$object
= json_encode([
   
'name' => 'Biodun Bamigboye',
   
'job_title' => 'lead developer'
   
]);
$userdataAsObject = json_decode($object);
echo
$userdataAsObject->name ;
 
/* return Value : Biodun Bamigboye */

 //-- To convert it to an array
 
$userdataAsArray = json_decode($object,true);
 echo
$userdataAsArray['name'] ;
 
/* return Value : Biodun Bamigboye */

 /*
Author : Biodun Bamigboye
 */