'Message: Trying to access array offset on value of type int
How to resolve this issues: Trying to access array offset on value of type int?
PHP8
public function processPayment(Request $request)
{
$orders = $request->get('order');
$ordersArray = [];
// getting orders details
foreach($orders as $order)
{
if($order['id'])
{
$ordersArray[$order['id']]['order_id'] = $order['id'];
$ordersArray[$order['id']]['quantity'] = $order['quantity'];
}
ddd($ordersArray);
}
Solution 1:[1]
I resolved my own problem using in this way: if(isset($order['id']))
before I did in this way:if($order['id'])
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ralfe |
