0

I need to grab a load of arrays that I am fetching in an array using a loop ie

$uuids = [];
foreach($data AS $item) {
  $uuids[] = $item->uuid;
}

$uuids = implode(",", $uuids);

But in this method I am returning

"123-asdf,122-asfdsa,2323-aewrq"

But I need

'123-asdf','122-asfdsa','2323-aewrq'

If i do the above as string concatenation ie

$uuids = "";
foreach($data AS $item) {
  $uuids .= "'$item->uuid',";
}

$uuids = implode(",", $uuids);

I get

'\'123-asdf\',\'122-asfdsa\',\'2323-aewrq\'

Which again I cannot use for a SQL where statement. Does anybody have any tips to help please?

Peter Ayello Wright
  • 127
  • 1
  • 3
  • 13

0 Answers0