anonīms Posted November 1, 2011 Report Share Posted November 1, 2011 Kā ir iespēja dzēst pirmo array elementu, ja tā "key" var saturēt jebko? Quote Link to comment Share on other sites More sharing options...
anonīms Posted November 1, 2011 Author Report Share Posted November 1, 2011 Lab, nezinu, cik gudri vai stulbi ir kas tāds, bet īpaši meklēties negribas šodien. $pane_i = 0; foreach($panes AS $title=>$value) { if($pane_i==0) { unset($panes[$title]); $pane_i = 1; } } Quote Link to comment Share on other sites More sharing options...
indoom Posted November 1, 2011 Report Share Posted November 1, 2011 http://lv.php.net/manual/en/function.array-shift.php Quote Link to comment Share on other sites More sharing options...
Grey_Wolf Posted November 1, 2011 Report Share Posted November 1, 2011 (edited) Lab, nezinu, cik gudri vai stulbi ir kas tāds, bet īpaši meklēties negribas šodien. ar lielgabalu pa zvirbuļiem ;) izstudē šo Ir speciāla f-ja kas to dara array_shift() Edited November 1, 2011 by Grey_Wolf Quote Link to comment Share on other sites More sharing options...
daGrevis Posted November 1, 2011 Report Share Posted November 1, 2011 reset($array); $first_key = key($array); unset($array[$first_key]); Labojums: ...vai array_shift(), par kuru tikko iemācījos! :D Quote Link to comment Share on other sites More sharing options...
Grey_Wolf Posted November 1, 2011 Report Share Posted November 1, 2011 (edited) Vispār PHP ļoti labi apstrādā masīvus, piedevām pat ir iespēja pašam uzrakstīt kārtošnas f-ju kas ļaus precīzāk definēt vajadzīgo darbību ... -- uasort — Sort an array with a user-defined comparison function and maintain index association uksort — Sort an array by keys using a user-defined comparison function usort — Sort an array by values using a user-defined comparison function Edited November 1, 2011 by Grey_Wolf Quote Link to comment 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.