note 111898 added to function.array-push

From: Date: Tue, 09 Apr 2013 17:47:32 +0000
Subject: note 111898 added to function.array-push
Groups: php.notes 
Request: Send a blank email to php-notes+get-194413@lists.php.net to get a copy of this message
function array_push_in_position($arrayAInserir,$indiceInserir,$insercao){ $parte1 = array_slice($arrayAInserir,0,$indiceInserir); $parte2 = array_slice($arrayAInserir,$indiceInserir); array_push($parte1,$insercao); return array_merge($parte1,$parte2); } //ex: quero inserir a palavra house, apos apos a melon. $words = array('banana','melon','car'); $words = array_push_in_position($words ,2,'house'); /* result: array(4) { [0]=> string(6) "banana" [1]=> string(5) "melon" [2]=> string(5) "house" [3]=> string(3) "car" } */ ---- Server IP: 69.147.83.199 Probable Submitter: 187.114.24.127 ---- Manual Page -- http://php.net/manual/en/function.array-push.php Edit -- https://master.php.net/note/edit/111898 Del: integrated -- https://master.php.net/note/delete/111898/integrated Del: useless -- https://master.php.net/note/delete/111898/useless Del: bad code -- https://master.php.net/note/delete/111898/bad+code Del: spam -- https://master.php.net/note/delete/111898/spam Del: non-english -- https://master.php.net/note/delete/111898/non-english Del: in docs -- https://master.php.net/note/delete/111898/in+docs Del: other reasons-- https://master.php.net/note/delete/111898 Reject -- https://master.php.net/note/reject/111898 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#194413) next »