dreamwest Posted June 4, 2010 Share Posted June 4, 2010 What is the best way to seperate this array? ["funny games","64,700,000 results","0"], ["funny jokes","20,200,000 results","1"], ["funny quotes","29,200,000 results","2"], ["funny pictures","141,000,000 results","3"], ["funny facebook status","20,100,000 results","4"], ["funny videos","72,000,000 results","5"], ["funny sayings","3,210,000 results","6"], ["funny exam answers","100,000,000 results","7"], ["funny names","99,400,000 results","8"], ["funny","262,000,000 results","9"] Quote Link to comment https://forums.phpfreaks.com/topic/203833-separate-this-array/ Share on other sites More sharing options...
kenrbnsn Posted June 4, 2010 Share Posted June 4, 2010 Please explain what you want better. Ken Quote Link to comment https://forums.phpfreaks.com/topic/203833-separate-this-array/#findComment-1067529 Share on other sites More sharing options...
dreamwest Posted June 4, 2010 Author Share Posted June 4, 2010 I want to just get the first result from each block input: ["funny games","64,700,000 results","0"] output: funny games etc.. Quote Link to comment https://forums.phpfreaks.com/topic/203833-separate-this-array/#findComment-1067531 Share on other sites More sharing options...
kenrbnsn Posted June 4, 2010 Share Posted June 4, 2010 Here's one way: <?php $ary = array( array("funny games","64,700,000 results","0"), array("funny jokes","20,200,000 results","1"), array("funny quotes","29,200,000 results","2"), array("funny pictures","141,000,000 results","3"), array("funny facebook status","20,100,000 results","4"), array("funny videos","72,000,000 results","5"), array("funny sayings","3,210,000 results","6"), array("funny exam answers","100,000,000 results","7"), array("funny names","99,400,000 results","8"), array("funny","262,000,000 results","9") ); foreach ($ary as $next) { echo $next[0] . "<br>\n"; } ?> Ken Quote Link to comment https://forums.phpfreaks.com/topic/203833-separate-this-array/#findComment-1067539 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.