Monday, 19 December 2016

PHP Array to stdClass Array – stdClass Object

<?php
$_TestAry = $this->_TestModel->getTestData();
if( isset($_TestAry) && !empty($_TestAry) && count($_TestAry) > 0){

 $_TestAry[count(_TestAry)+1]   = new StdClass; 
        // avoid warning creating default object from empty value

 $_TestAry[count(_TestAry)+1]->id   = 11;

 $_TestAry[count(_TestAry)+1]->name   = 'Jayakumar';

}
?>

No comments:

Post a Comment

Git merge branch to another branch

$ git checkout develop $ git pull $ git checkout test-branch $ git merge develop $ git push