php - Create three array from other array -
this question has answer here:
- how create multiple array array? 1 answer
i have array below.we need create 3 array array.we need seperate facebook inside array , other twitter,email.
is possible?
array ( [01] => array ( [facebook] => 375 [twitter] => 3276 [email] => 3276 ) [02] => array ( [facebook] => 385 [twitter] => 3326 [email] => 3326 ) [03] => array ( [facebook] => 391 [twitter] => 3327 [email] => 3327 ) [04] => array ( [facebook] => 446 [twitter] => 3327 [email] => 3327 ) [05] => array ( [facebook] => 486 [twitter] => 3334 [email] => 3334 ) [06] => array ( [facebook] => 2 [twitter] => 6 [email] => 6 ) [07] => array ( [facebook] => 1 [twitter] => 7 [email] => 7 ) [08] => array ( [facebook] => 3 [twitter] => 11 [email] => 11 ) [09] => array ( [facebook] => 0 [twitter] => 0 [email] => 0 ) [10] => array ( [facebook] => 0 [twitter] => 0 [email] => 0 ) [11] => array ( [facebook] => 0 [twitter] => 0 [email] => 0 ) [12] => array ( [facebook] => 0 [twitter] => 0 [email] => 0 ) )
we need three(facebook,twitter,email)
array( [01]=>385, [02]=>375, [03]=>391, [04]=>446, [05]=>486, [06]=>2, [07]=>1, [08]=>0, [09]=>0, [10]=>0, [11]=>0, [12]=>0, }
$your_array = //here have original array $facebook = array(); $twitter = array(); $email = array(); foreach($your_array $sub_array) { $facebook[] = $sub_array["facebook"]; $twitter[] = $sub_array["twitter"]; $email[] = $sub_array["email"]; }
Comments
Post a Comment