Reputation:
I'm currently developing an API using Laravel for my project, the concept:
["ObjectA", "ObjectA_quantity", "ObjectB", "ObjectB_quantity", ...]
.["pizza", "1", "burger", "2"]
, and the User Input's Array got ["pizza", "1"]
, the output of the method is expected to be ["burger", "2"]
.The method that I developed will give inconsistent and confusing output, like for some object, it works well, for other it doesn't eliminate anything and if the User Input's Array too big (> 1 object), it also doesn't eliminate anything. I really welcome different approach or anything else that will give the expected output as above. Thank you very much
Here's the source code of the method I've develop: (method's located on: else if ($transactionGetter->type == 'return')
, Line 148 and so forth)
Upvotes: 0
Views: 76
Reputation: 474
if it's a JSON you must decode the value before access
$transactionGetter=json_decode($transactionGetter);
Upvotes: 1