itai
itai

Reputation: 7

removing certain elements from a string

I would like to change the following content to a string in php so that the names come out as this

itai,bliss

instead of this which is showing in my blade file

"["itai","bliss"]"

ive tried to do this in my controller but its showing an invalid result.

$minute = Minutes::find($id);
$minuteSlash = $minute->attendances;
$attendees = substr($minuteSlash, 2, -2);

is there a way i can do this

Upvotes: 0

Views: 38

Answers (1)

Attiq Ur Rehman
Attiq Ur Rehman

Reputation: 419

I hope this can solve your problem.

$attendees = str_replace(["\"", "[", "]"], "", $minuteSlash);

Thanks

Upvotes: 1

Related Questions