n00b3 Posted March 22, 2008 Share Posted March 22, 2008 Hello, <?php $somestr = "0,1"; $array = array($somestr); print_r($array); echo count($array); /* The above code prints out the following: Array ( [0] => 0,1 } 1 However, I want the following: Array ( [0] => 0 [1] => 1 } 2 */ ?> How do i get the string "0,1" to act more 'literally'. That is, I would like the string to be the two arguments into the array function rather than just the one "0,1" argument. The variable $somestr can be any variable type. I tried array({$somestr}) {array($somestr)} array((binary) $somestr) But these three attempts resulted in errors or not the desired result. Thanks in advance. DanK Quote Link to comment Share on other sites More sharing options...
Barand Posted March 22, 2008 Share Posted March 22, 2008 $array=explode(',' , $somestr); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.