array('qty' => $gstQty, 'free_qty' => $gstFree), 'cash' => array('qty' => $cashQty, 'free_qty' => $cashFree), 'offer' => $offerType . ' (Even GST logic)' ); } // Test with 40+20 example $split = splitOffer(20, 10); $ef_gst = array(); $ef_cash = array(); array_push($ef_gst, array( "prod_id" => '297', "qty" => $split['gst']['qty'], "free_qty" => $split['gst']['free_qty'], "offer_type" => $split['gst']['offer_type'] )); array_push($ef_cash, array( "prod_id" => '297', "qty" => $split['cash']['qty'], "free_qty" => $split['cash']['free_qty'], "offer_type" => $split['cash']['offer_type'] )); echo 'gst
'; print_r($ef_gst); echo '
cash
'; print_r($ef_cash); ?>