• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

PHP HELP!

zimu

Diamond Member
Ok i need php help again!

lets say i have an associative array
$test=array("one"=>"1", "two"=>"2","threefourfive"=>"3,4,5");

and i actually create a coma separated list in the input (NOT an array, its just a comma separated list), is there some way to find out if the element is a scalar or a vector?

i know they are all scalars, but i want the computer to recognize "threefourfive" as a VECTOR, or convert it into a vector.

I tried explode(", " , $value); where value was derived from a foreach loop, and contains only the value.
That didnt' work, it returned each value as an array, "one" and "two" only having one element while "threefourfive" having 3. but i want one and two to still be scalars!

Help!
 
Originally posted by: zimu
Ok i need php help again!

lets say i have an associative array
$test=array("one"=>"1", "two"=>"2","threefourfive"=>"3,4,5");

and i actually create a coma separated list in the input (NOT an array, its just a comma separated list), is there some way to find out if the element is a scalar or a vector?

i know they are all scalars, but i want the computer to recognize "threefourfive" as a VECTOR, or convert it into a vector.

I tried explode(", " , $value); where value was derived from a foreach loop, and contains only the value.
That didnt' work, it returned each value as an array, "one" and "two" only having one element while "threefourfive" having 3. but i want one and two to still be scalars!

Help!

I don't quite understand. You basically want to take the string "3,4,5" and turn it into an array(3, 4, 5)?

$newarray = explode(',', $test['threefourfive'])

$newarray would now be 0=>3, 1=>4, 2=>5

not sure if that's what you wanted.
 
Back
Top