-1

i have in my row an array when i go this result

{"type":"person1","id":"12"}

I want just to get the id as result value 12

devpro
  • 16,184
  • 3
  • 27
  • 38

2 Answers2

0
$addedBy = json_decode($row['added_by']);
$id = $addedBy['id'];
Gennadiy Litvinyuk
  • 1,536
  • 12
  • 21
0

Use json_decode:

$value = ' {"type":"person1","id":"12"}';

$result = json_decode($value, true);

echo $result['id'];   // 12
devpro
  • 16,184
  • 3
  • 27
  • 38