$p_list="1,2,3,4";
我想把它轉換爲
$a[0]='1';
$a[1]='2';
$a[2]='3';
$a[3]='4';
如何在PHP做這樣的一個數組一個字符串變量?
$p_list="1,2,3,4";
我想把它轉換爲
$a[0]='1';
$a[1]='2';
$a[2]='3';
$a[3]='4';
如何在PHP做這樣的一個數組一個字符串變量?
嘗試爆炸$a=explode(",","1,2,3,4");
試試這個:
In PHP, explode function will convert string to array, If string has certain pattern.
<?php
$p_list = "1,2,3,4";
$noArr = explode(",", $p_list);
var_dump($noArr);
?>
You will get array with values stores in it.