I want to know how can I create object like below example. Please help me to create object. I searched in google but I didn't get what I want. I'm noob.
{
"ERROR_CODE" = 0;
"M_USER" = {
"CREATE_DATE" = "2018-05-09 13:57:49";
"CREATE_USER_ID" = t1074567;
"FACE_PICTURE_FILE_PATH" = "<null>";
"MAIL_ADDRESS" = "[email protected]";
"NATIVE_LANGUAGE_CD" = 102;
"REQ_LANGUAGE_CD" = 102;
"TERMINAL_ID" = "C71B456F-EA16-4734-8C9B-00B0856143DA";
"TERMINAL_TYPE" = 1;
"TOTAL_GRADE" = 0;
"TRANSLATABLE_FLG" = 1;
"UPDATE_DATE" = "2018-05-09 13:57:49";
"UPDATE_USER_ID" = tdu1074567;
"USER_ID" = tdu1074567;
"USER_NAME" = Testing;
"USER_PWD" = testing123;
"VALID_FLG" = 1;
};
"TRANS_LANGUAGE" = (
{
C = 102;
L = 10203;
},
{
C = 101;
L = 10101;
}
);
}
Using the PHP unset() function, we can delete an object. So with the PHP unset() function, putting the object that we want to delete as the parameter to this function, we can delete this object. This is shown below. So in the above code, we delete an object named $object1.
Objects of a class is created using the new keyword.
Using new stdClass() to create an object without class: For creating an object without a class, we will use a new stdClass() operator and then add some properties to them. Syntax: // Creating an object $object = new stdClass(); // Property added to the object $object->property = 'Property_value';
In PHP, Object is a compound data type (along with arrays). Values of more than one types can be stored together in a single variable. Object is an instance of either a built-in or user defined class. In addition to properties, class defines functionality associated with data.
Here is a solution
$newObject = new stdClass;
$newObject->ERROR_CODE = 0;
$newObject->M_USER = new stdClass;
$newObject->M_USER->CREATE_DATE = "2018-05-09 13:57:49";
And so on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With