文字列:
user:hello,user2:world
望ましい出力:
$string = array(
1 => array( 1 => "user", 2 => "hello"),
2 => array( 1 => "user2", 2 => "world")
);
私が試したこと(それはうまくいきません):
$string = explode(',',$string);
$string = explode(':',$string);
エラー:explode() expects parameter 2 to be string
文字列から目的の出力を取得するにはどうすればよいですか? ありがとう!