Monday, 26 August 2013

Create Array out of a plain text variable?

Create Array out of a plain text variable?

I am trying to create an array from a plain text variable like so:
$arraycontent = "'foo', 'bar', 'hallo', 'world'";
print_r( array($arraycontent) );
But it outputs the entire string as [0]
Array ( [0] => 'foo', 'bar', 'hallo', 'world' )
I would like 'foo' to be [0] bar to be [1] and so on. Any pointers? Is
this even possible?

No comments:

Post a Comment