📜  array_agg php 到数组 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:19.290000             🧑  作者: Mango

代码示例1
// Postgresql arrays look like this: {1,2,3,4}
$x = '{1,2,3,4}';
$y = json_decode('[' . substr($x, 1, -1) . ']');  // [1, 2, 3, 4]



// To cast back the other way would be mirror opposite:
$y = [1, 2, 3, 4];
$x = '{' . substr(json_encode($y), 1, -1) . '}';