How to split up the value to an array. I have the whmcs api data it looks like 1,2,3,4,5. I need to split up the value to an array value suggest any solution
My api data
Array
(
[result] => success
[totalresults] => 2
[promotions] => Array
(
[promotion] => Array
(
[0] => Array
(
[id] => 6
[code] => 0UP3NU5J7J
[type] => Percentage
[recurring] => 0
[value] => 15.00
[cycles] => One Time,Monthly,Quarterly,Semi-Annually,Annually,Biennially,Triennially,1Years
[appliesto] => 1,2,3
[requires] => 1,2,3
[requiresexisting] => 0
[startdate] => 2018-10-22
[expirationdate] => 2018-10-25
[maxuses] => 0
[uses] => 0
[lifetimepromo] => 0
[applyonce] => 0
[newsignups] => 0
[existingclient] => 0
[onceperclient] => 0
[recurfor] => 0
[upgrades] => 0
[upgradeconfig] => a:4:{s:5:"value";s:4:"0.00";s:4:"type";s:0:"";s:12:"discounttype";s:10:"Percentage";s:13:"configoptions";s:0:"";}
[notes] =>
)
)
)
)
My code is
@foreach($response['promotions']['promotion'][0] as $key => $value)
@if($key == 'appliesto')
{{$var=$value}}
@endif
@endforeach
I need to split the "appliesto" value as an array.Please suggest any solution