Thank you very much. Yes, from what I read its not the best way to handle data. My wordpress plugin is using this structure, so I have to abide by it.
I modified your code to accept values, is this correct?
$data = [ 'count' => $rating_count, 'total' => $rating_total', 'average' => $rating_average ];
So, I see a**holes from stackoverflow migrated to this forum? Why are you condescending ?
Im not a coder and using this in my side wordpress project and i just need small piece of puzzle.
"And there are no 'serialized functions'." clearly you are the one needs another line of work: https://www.php.net/manual/en/function.serialize.php
Its a php function: https://www.w3schools.com/php/func_var_serialize.asp
I need a function that will take three numeric values and output it in the serialized format.
Hi everyone,
I need help writing a custom php function that will serialize three unique values in the following format. I have three values: Count, Total, Average and all three are numeric values.
Here is an example of the output:
a:3:{s:5:"count";i:1;s:5:"total";i:5;s:7:"average";d:5;}
And this how it looks unserialized:
{
"count": 1,
"total": 5,
"average": 5
}
You can call the values rating_count, rating_total, rating_average. Thank you in advance.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.