How to convert string number in an array object into integer? [duplicate]

  laravel, php

My Code: $finalArray = json_encode($loanTypeCount);

Output:

[{"name":"Salary","y":"6"},{"name":"Emergency","y":"1"}]

Desired Output

[{"name":"Salary","y":6},{"name":"Emergency","y":1}]

No " " dobule quotes anymore in number 6 and 1. What is the way to do it in laravel/php?

Thank you.

Source: Laravel

Leave a Reply