'PHP, imploding an array sent via axios

I'm trying to implode an array into a comma separated string for sql usage, but my current implode function gives my sql a syntax error because it says 'AND number in ({"num":"145"})`

My php has:

public function getInfo($query, array $num = []){
    
    $numClause    = empty($num)      ? '' : 'AND NUM IN ('.implode(',',$num).')';

    dd($num);
}

That dump/die shows this:

array:1 [
  0 => "{"num":"145"}"
  1 => "{"num":"325"}"
]

So I'm sending the array to this function from an axios call, I'm getting the array in the function as shown in the dump, but the implode is not creating a comma separation of 145,325,etc.

What am I doing wrong with this implode?

php


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source