php - exploding textarea values into multiple array -


exploding textarea value this:

explode("\n", $input); 

would result in 1 array.

currently, storing $input in textarea this:

a1 a2 a3  b1 b2 b3  c1 c2 c3 

but want multiple array result this:

$test[0][0] = 'a1'; $test[0][1] = 'a2'; $test[0][2] = 'a3';  $test[1][0] = 'b1'; $test[1][1] = 'b2'; $test[1][2] = 'b3';  $test[2][0] = 'c1'; $test[2][1] = 'c2'; $test[2][2] = 'c3'; 

any idea, how can implement?

explode two newlines separate groups, explode each group single newline:

$result = array_map(     function ($group) { return explode("\n", $group); },     explode("\n\n", $input) ); 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -