php loop through array

Solutions on MaxInterview for php loop through array by the best coders in the world

showing results for - "php loop through array"
Gaspard
29 Aug 2017
1$clothes = array("hat","shoe","shirt");
2foreach ($clothes as $item) {
3	echo $item;
4}
Cristóbal
23 Feb 2017
1for ($i = 0; $i < count($array); $i++) {
2    echo $array[$i]['filename'];
3    echo $array[$i]['filepath'];
4}
Stan
29 Nov 2018
1foreach (array_expression as $value)
2    statement
3foreach (array_expression as $key => $value)
4    statement
5
Giorgio
13 Mar 2020
1$letters = ['a','b','c'];
2foreach ($letters as $item) {
3  echo $item;
4}
Hiba
14 Mar 2019
1foreach($array as $item=>$values){
2     echo $values->filepath;
3    }
Dante
24 Oct 2017
1foreach($array as $item) {
2    echo $item['filename'];
3    echo $item['filepath'];
4
5    // to know what's in $item
6    echo '<pre>'; var_dump($item);
7}
queries leading to this page
loop through an associative array in phpiterate array phpuse loop arry in arry phpforeach iffi php with foreachphp forech in arraycreate javascript array in php loophow to loop thru array phpfor array loop data get phploop in array phploop the array in phpfor each entry in array phpphp use for loop to create arrayloop associate array phpphp loop through array and checkiterate arraycin phpget each value in for looplooping through an array in phpeach in phpiteration phpforeach php key valuephp foreachforeach in html phploop data in array phploop through array php posthow to loop through array phpphp array to javascript array and loopfor loop in for each phphow to use a foreach loop in phpfind in foreach phpeach function in phphow to use foreach loop in foreach loop in phpif element is in array foreach phpphp for each explainedhow to echo arrays by using for loop phpphp for loop on arrayhow to loop through an array of arrays phplooping data array phpecho iterate array phpphp for loop index arrayfroeach phpphp loop arryphp forecahphp foreach htmlforeach loop ppharray inside array loop in phpwhile loop iterator array phploop trough array keys and valuesrun array phpforeachh loop phpforeach problem phpphp lopp arrayitirate through array in phpphp go through array each valuehow to loop over a array phpin php each statementloop through array php whilehow to loop through array in phpusing foreach in arrays phphow arrays passed to for loop phphow to iterate through values and add to array in phpphp foreach iterating more than elementsforeach in php for arrayusing for loop to read array values in phpphp foreach list array htmliterating through key value arrays phpphp foreach as 26array foreach phpphp foreach with for loopfor in phphow to looping for array phpfor each loop 4 fields phptechnique loop array exist in php foreach ifphp array loop loophow to traverse loop in phpphp iterate through array 5cloop through php arrayphp for loop array variablephp for loop numb from arrayecho foreach arraytraverse array in phpdata in array php from loopphp create an array using foreachfor element phpforeach for phpphp array in foreachphp foreach iterratorphp go through array functionhow to go through an array phpphp loop an arraywhat is the syntax of the foreach loop in case of associative array 3f a foreach 28 24array as 24key 3d 3e 24value 29 b foreach 28 24array as 24key 3a 24value 29 c foreach 28 24array as 24key 3a 3a 24value 29 d foreach 28 24array as 24key 3a 3e 24value 29foreach key array phparray loop with php methodforeach array php key valueforeach loop function in phpphp get array looploop thru array phpforeach program list in phphp how to use eachforeach all phpiterate over an array inside a for each loop phpphp for each looiterate php arrayphp loop through data to arrayphp foreach integer numberphp foreach funtionpph loop arrayphp array for loopphp array loopsarray foreach in phpcreat for loop item html phpdisplay array with for loop phpphp for arrayiterate through array in phploop an array phpphp each array itemarray loop function call in phpphp for 28 3b 3b 29for loop and array phpphp foreach from 5b 5dhow to iterate data annd store in array i key value pair for each phphow loop through array in phploop through arrays in phpneed to iterate through each key in foreach loop phpwhile loop to loop through an array in phpphp array forechforeach to for phpphp foreach syntaxfor loop store values in array in phphow to loop on array phploop value with key phploop array in phphow to loop an array in phpphp forphp foreach what is asphp foreavhphp foreach loop variable only using one loopprint array with foreach in phpphp loop 5barray 2c array 5dforeachemdforeach loop in phpphp array in for loopget value from array php loopdo while to iterate though array phpforeach value return phhmake array in foreach phpfor loop to loop through array in table phphow to for loop through php associative array for loopforeach php 3d 3ephp foreach 24variable 2b 3dforeach work with in phpiterate php associative arrayforeach explained phpget values of array 1 by 1of each loop phpphp loop throught arrayphp get array number in foreachphp foreach loop iterate a numberread array item php foreachboucle foreach phpphp array is looping 3flooping through array in phphow to access array elements in loop phpcreate array in php using for loop 40foreach in html phpphp loop array whilehow fetch seperate values from loop each itrationphp for or foreachphp create foreachlooping array phpget second array key value in loop phpfor each in phpforeach more than array length phpget foreach in array phpfor loop make array phpphp reference variable in foreachloop through array values changed phpphp foreach meansloop and array in phpforeach hphow to get a step by step value of array in php through loophow to iterate through php arrayphp iterate array with for looploop through array php with forphp iterate trhough array key valueforeach element in list phphow to loop through an array in phphow store in php array of objects foreachhow to loop array in phpphp for loop through array lengthphp foreach print arrayforeach n 3d1php foreach arrayphp itterate arrayphp array loop key valueforeach 24i 2b 2b 20 phpphp iterate through arrayforeach php syntaxfor loop key value phphow to use foreach in phpphp fastest way to loop through arrayiteration in foreach php 24iarray value in foreach phpphp loop arrarhow to loop on array in phploop against an array in phpfor loop aarray phpphp foreach in htmlforeach in php 7foreahc phploop array to array of arrays phparray in php loopphp echo array values foreachtechnique loop array exist in php foreachphp loop array different arrayphp iterate arrayphp loop through array of arrysphp loop array with in arrayphp foreach iphp loop through 4 levels arrayphp forech in 40foreach phpwrite an array in php for variable in foreachphp loop arrayhow to loop through an array of arrays in phploop through items in php and store in arrayusing a function in a foreach loop in phpfor eache php only some abjectphp foreach assocphp loop through array until cerainphp foreach data to arrayloop thrue array phpiterating array in phpgo loop over array phpphp loop thorught arrayloop through array of arrays phplooping in array in phpuse of foreach loop in phpphp each forphp print array foreachhow to loop thru each index php listforeach as key valuephp foreach 5b 5dphp forelseforeach on dictionary phpforeach loop to an array phpget array value using for loop in phplooping in array phphow to store loop inside an array in phploop to array phploop through a php arrayphp soreachforeach program list in phpphp get through arrayphp while iterate arrayfor each phphow to store values in array in php using for loopphp echo loop arrayphp foreach array 0each php exampleforeach inline condition php with foreachphp array forphp loop through array of integersphp step through array in 2php loop over an arrayphp for loop as how to make the array using foreach statement in phpphp while arraufor loop for array in phphow to irerate through array in phplooping over an array phpforeach php strings ti arrayuse array in loop in phpiterate arrray for in phpphp loopover arrayhow to create foreach loop in phpgo through an array phpfor ecah phpphp loop though array find key value with nameforeach laravel arrayhow to iterate through array phpphp index foreacharray with for loop phploop thgouth and store as array in phparray for phpphp foreach loop example 5cloop in array in phpphp for loop arrayhow to loop through and print array values of a large php arrayarray foreach in phpget a value from an array for loop phphow to display array for looping in phpphp loop through array lenghtiterate over php array 2b php 7loop to get array phploop through array javascript phpforeach loop php arrayphp loop array valuephp loop through array and add new key with value for each recordcreate php foreachforeach keyedlistphp array functions iterate arraysphp foreach on an arrayforeach array in array phpf or loop for array phploop through php array and set data attrloop 24i 2b 2b array phpphp 7 foreachhow to use array in php loophow to get array values using foreach phpiterate php vectorphp for each element in arrayphp foreach in stringphp for array loophow to itrate over array in phpphp foreach array valuehow to iterate array in phpforeach loop phphow to use looping in php for arrayloop array phphow to loop with php through arrayphp for loop through arrayloop in php arrayforeach on an array phploop js array in phphow to affect loop data to array phplooping through an array of arrays in phploop key value array in phpforeach only 2 array items phpphp forachcycle through array phpwhen to use foreach and for in phpfor loop to loop through array phphow to use foreach phpfor loop array phpphp key value foreachforeach array of ints phploop through array php foreachforeach 28 29 phpphp array loopforloop to iterate array phpphp associative array foreach key valuephp through arrayphp foreach loop arrayall foreach return in one array phpphp for loop arrayhow to for loop array in phpphp array foreach exampleforeach loop through array phploop through array from index phpforeach html phpphp loop on array over otherfor loop trhough array phpphp for each arrayforeachloop phpkey value iteration phpwhat function to loop through array phphow to iterate array without loop phpphp how loop arrayphp test foreachlooping through an array of numbers phpphp get value of each arraywrite data of array to variables in php with foreach loopcreate array in foreach loop phphow to create array with loop in phpphp iterate over arrayphp foreach use 24thisarray php foreach key valuemake array with loop phploop through array of array phpforeach loop foreach value is arrayphp array for eachloop through array php to given numberin loop make array in php foreach with 24i 2b 2b phphow to access through array phploop trought array get 2 values at a time pphphp 2bforeach over an arrayforeach loop if meet array element phpphp loop over arraylooping through elements in a php arrayphp array loop functionloop all array phpphp create array in a loopget iterator foreach php 3c 3fphp foreachphp foreach key as valueiterate through list phpfor loop array get value phpfor php arrayloop list phpforeach operation in array phpphp manually load an array though a loopfor loop php true a arrayphp array in foreach loopforeach statement phpphp array foreachhow to get array value of 0 in foreachfor loop php listloop through array in array phpphp in foreach looploop through array php with foirphp loop over array enumeratefor each value in array phploop use in php arrayforeach php by referencehow to make an array with foreach loop value in php usingeach phpphp for loop from arrayphp for loophp foreach array numbersphp foreach a numberfor each in phpforeach in array phpforeach php htmlloop thru array in phpforeach phpnetphp array as for looploop through array from position phpforecach phpphp iterate through array of arraysforech in phpphp foreach key valueforeach loop array key value php for each php array iteration and displayphp looping through arrayfor array loop phpphp foreach array in arrayforeach key phploop through an array phpphp foreach iteration numbertraverse array of array in phpphp look through arraycheck foreach in php array stop elseforeach with keyphp loop listiterate with array phpphp foreach item in array to keyhow to iterate to array in phpfor each asfor loop list phpphp loop over arrphp foreach array with key and valueforeach key value with index phpphp while arrayfor loop inside array phpforeach 28 29 3a phphow to write a for loop for array in phpphp step through arrayaccess array values php foreachphp 5 foreach exampleloop through array 28 29 in phphow to loop array of array in phpphp array with for loopforeach funtion phpphp foreach array without keysloop array property in phpphp go through arrayphp array iteratehow to view array data in foreach in php 40foreach 28 24items as 24key 3d 3e 24value 29loop through array values phploop througn array phpfor loop in php on arrayloop in array function phpprint array foreach phploop array string phphow to loop through an array php foreachforeach php ex how to loop over array in phpphp foreach 26 24valuephp 8 foreachphp best way to loop through arrayphp foreach with keyphp array iterationphp loop array requestedforaech phpforeach as phparray in array php foreachphp loop through array number and get that arrays key valuesecho foreach array phpphp loop inside arrayloop through array php forarray loop function phpphp array foreach 28 24array as 24key 3d 3e 26 24value 29 7bhow to create an array variable in php whike looploop over and return an array phplooping over a form element using a php arrayfor loop with array in phploop through properties in array phphow to display an array using for loop in phpusing foreach in php for arrayphp loop thorufhg st arrayforeach i phpforeach string phpfor loop php arrayphp array on looploop though numeric array phpphp for loop key valuefor array in phpphp for loop through array lenghthow array is declared in php 3f what is the role of foreach loop in php explain with exforeach php arrayphp foreach 26for item in items phpfor loop in php with arrayhow to return array loop phpphp how to loop through an array with htmlphp create array with loopphp foreeachiterate through array phploop throu array vlues phpfor or loop for array phpthis in foreach phpphp foreach array functionhow to iterate array through phpeach php functionloop a arry phphow to loop over php arrayhow to loop throug items and create an array of items in phphow to for item in list phploop through php array by index and keyarray in array foreach phpphp for loop array itemphp foreachloopphp for eachphp make array loopforeach values to array phphow to call function in foreach loop in phpphp how to loop array for some elementsphp loop through array to find valuefor each in array phpphp loop through an arraykey value foreach phploop through array php pdphpexcel loop through arrayarray looping in phpforeach syntax phpforeach value in array phpforeach 28 29 3a phpforeach php 2 timesiterate over php arrayphp foreach loop iteratefor loop for array phpphp foreach print array key valuelooping array using phpforeach array print phpphp iterating through arrayfor cycle phpforeach 28 24key 24value 29 from an arraylooping in phparray get valu loop in phploop an array using value phpforeach php 5carray iteration phpforeach where phpfro each phpforeach show array phpphp foreach array of stringsiterate through array with keysarray loop php codephp foreach array with 1 elementphp loop array of arraysloop through array phpfor loop in php array exampleloop torugh key in phphwow to iteratre between array elements in phpphp loop through id stored in arrayiterate an array of array in phpcreate array in php looploop for array in phploop on arrayphp 3c 3f 3dforeach phpphpexcel write loop through arrayforeach echo component phpphp for loop over arrayphp 5 check array in array with foreachfor loop in array in phptraverse values passed in aphp functionphp foreach through arrayloop through array of objects and create variables phphow to print a array using loop in phpfor loop according to number of elements in array phpworking of foreach loop in phploop through array in phpphp code to loop through an arrayhow to loop array phpphp for each in an arrayphp in html for eachforeach in in phploop through php associative arrayfphp foreeachforin php arrayphp eachfor in loop phpphp create array with a loophow to store every string comes from for loop in array in phphow to loop through array on specific element phpforeacht phpiterate through array with for loop phpforeach php take value in arrayphp array in loophow to iterate array of array in phpusing for each phpiterate through array with while phpphp loop per selexzioneloop through php array in javascriptloop through an array on phploop over an arrar phpphp for loop each element in arrayphp foreach 3d 3eloop though array phpphp print array using foreachbuild an array with for loop phpdifference for foreach phphphp foreach on non array values arrayphp list all array for loopsloop through an array using foreach in phpphp array value get loopforeach function in php foreach phplooping through arrays in phpfore each phpphp make array from loopforeach in php arrayforeach as 24varialbe 3esomethinghow to loop through each element in array phpphp loop through an associative arrayboucle for php with dataphp for each array loopforeach 28 24data as 24row empid 2c counter array 2b 2b 29php loop array and display valuefor in foreach phpphp fpr each loopmake array in loop phploop on array php examplephp for loop with arayfor loop array php examplephp foreach loop through arrayphp foreach element in arraycreating array in for loop phphow to loop array in array in phpphp forealooping throudh array phpphp each functionhow to get array value with loop in phpdisplay array php foreachphp for earchphp for inforeach php keyphp loop array to variablehow to make array in array in for loop phpsyntaxe foreach phparray in loop phpforeach php stringarray function to loop through all its value in phpuse array in for loop phpphp create array of loopphp how to loop through array and add new element with value for each recordforeach function to array phploop through array if statement php php loop throught array if it has valuesphp array of values for each keyhow to loop in array of array in phpecho each item in array phpphp array traverseforeach array element phploop create array phptraverse an array in phpiterating though an array 2c phpforeach loop php tutorialcakephp loop through arrayphpforeacharray loop phplooping through a list phpphp foreach associative array key valuephp iterate through arryaforealse in phpfor php loop arrayhow to access the array elements using for loop in phpcan we write foreach inside foreach in phphow to loop through an array with a for loop in phpphp foreach function call from return arrayphp for loop echo arrayloop through elements of array phploop though numeric arrayafter for each loop in phpgo through list for phparray php foreachphp array cycle throughforelse in php foreach 28 29 in phpforeach 1 to 5 phpphp foreach one argumentlooping through php array 5b 5dphp build array in looploop an array in phpforeach sql phpphp foreahfor loop through php arrayecho array php foreachphp create array and loop throughphp loop through associative array in arraycreate array from loop phpphp for in arrayiterating over a n array phparray in array php foreach exampleparsing key values with foreach phpforeach array phpforeach loop from arrayforeach loop key value phplooping value from php arrayloop an print through array phpforeach key nameloop through arry phpphp create array of arrays in looparray php foreach 26 for each array phpphp foreach stringloop php with array php for each 9 timessyntax for each loop in phpaccess array element for loop in phpget and value of array php foreachloop through array string in phpphp foreach inside array variablephp foreach on stringuse foreach for array in phpphp read array for loopforeach key value phpphp use in foreachforeach 28 29 phpforeach get primarekey phpphp foreach loophow to loop through array object in phpphp for laap for arraypgp iterate associatitive arrayfor loop array value phpfor loop display array phpforeach syntax in phpphp loop through get arrayforeach phphfor each loop php php 7how to traverse the array using for loop in phpphp for each in arrayhow loop in php arrayphp foreach keyforeach val array phpfor loop display only value in phpfor each make array phpphp forechhow to use foreach loop in phpdisplay array values using php for loopgo through array phphow to get array values in for loop in phpphp foreach syntax in htmlarray walk with for loop in phpphp echo foreach arrayfunction for each phpforeach index phpphp loop over listfor i array phpdisplay array in foreach loop in phpfor each loop in phpwhat is foreachfor loop go through array phpcreate array inside array in loop phpphp foreach array as arrayloop array in array phploop through numeric array phpphp iterating through associative arrayfor each post phploop in arry phphow to get array from array in foreach in phpphp loop throught a arrayfonction foreach phpphp fore eachfor in php arrayloop though a array phpget foreach value after loopphp loop array functionsforeach php examplephp foreach key numberphp loop arrayfor loop in php arrayforeach of array phparray foreach phphow to iterate in array phpphp for with arrayphp how to add elements to existing associative array based on if statement results using foreach looparray iterator in forr loop phpphp for and foreach togetherphp loop display arrayarray data in use for loop in phpwhat does 26 var do in php foreachfor loop through array phpfor loop in array phpmake array from looping phpphp foreach starts over and overphp arry looploop thorugh array phploop with array in phpforeach with a string phphow to loop through php array foreachforeach key and value in phpphp foreach i 2b 2barray iterationr phplooping through array phpfpr phpphp loop over araryforeach 28 24array as 24key 3d 3e 24value 29 exampleloop php arrayhow to get array value in php using for loopphp simple array loopget each element of array phpforeach array of array phpphp loop through embedded arrayhow to iterate through an array phpforeach key and value phpphp how to loop through an arrayarray in constant php foreach loopphp for loop on php arrayiterate through an array phpphp loop over arrayyfor loop through an array php how does foreach work in phplist for loop phpiterate over array in phpphp cycle through arrayloop through arry of integers string in phploop on array phpfor loop looping through array phpphp loop through arrayphp loop through array shorthow to get foreach loop values in array in phpfor array phpforeach inside string phpforeach 28 24collect as 24key 3d 3e 24val 29loop in array php array for loop in phploop over array phpforeach array in phphow to loop through php arrayphp foreach unpackphp loop string arrayfor each loop into same function phpforeach php create arrayphp foreach whenwhy i can loop array in phphow to loop through arrays in phphot get value from foreach phploop through list phpforeach array liste phploop over each element array phplooping through aray in pphphp foreach array get key and valuewhile loop in php iterate arrayloop over elements array phparray and loop example phpecho foreachlooping through php arrayshtore data in array loop phpget all element from array in for loop phpforeach in php iraloop through loop through array phploop for array phpphp loop array inside elementphp foreach 24 24loop for array value phpfor each array loop phpfor loop pgphow to make a array from loop in phpphp how to iterate through an arrayarray to string variable in for each loop phpphp while array loopiterate in data array phpfor loop for all the elements in an array in phploop through array php to given indexfor loop on array in phparray of for loop data in phpforeach loop in php 27array for loop phphow to write a for loop that runs through an array in phpmethods for iterate over php arrayiterate phpphp foreach array variable output with keyhow to write a for loop into a array usinhg phpstep through an array in a loop phphow to use for loop in php arrayiterate over array php examplesusing foreach loop in array phparray in for loop phpphp array of array loophow to store for loop values in array phphow to array in loop in phpwhile array content phphow to get array values using for loop phploop through an associative array phpphp for array loop hmltpforeach 28 24arr as 24letter 29 7bwrite array forech phphow traverse array element in foreach phpgeneric for loop phpforeach 24key 3d 24valueget array of object 2c iterate only first one phpmake array parameter from looping phpphp foreach item in arrayforeach php listloop each element in array phpgo through array in phpphp loop through array with indexforeach in phpphp arrays loop assignmentfor loop with array phpphp array iterate while nextloop through an array in phpphp foreach loo 5blop through array phpphp for loop acces array elementwhile loop through array phpdefine array php and loop arrayarray iterations phpsimple basic use php array store looping valuehow to loop through an associative array in phpprogram in foreach in phpphp iteratebest way to iterate over an array elements phpphp for loop with arraylooping through php arrayshow to use for loop in array in phpecho forach loop phphow to loop through inner array in phploop through post array phpphp foreach 9 timesfor loop in php for arrayfoor loop array php loop trough array phploop over elements in array phpphp array loop through array the arraycheck is array or object in php when foreachphp loop into array phpfor each thing in thing phpget the value in array php for loopdisplay array item in loop phpphp for loop in arraytraverse associative array phpphp iterate through asociative arrayphp run loop on arrayfor each phploop array trough function phpiterate over an array phpforeach php parameterphp looping an arayphp loop through array foreachecho array value in for loop phpphp loop troug arrayphp foreach item in array and indexcreate array with loop phptechnique loop array exist in phpphp loop thru arrayiterate on array with value phparray iteration in phpphp foreach array examplefor lopp for arrays in phpphp foreach variable create arrayforeach in phparray foreach phphphp loop over array indexloop arraylist php 3c 3fphp foreach 28 24my table posts as 24post 29 3a 3f 3ephp iterate array for loopphp loop in arraycreate new array on loop phptraverse array inside array phpphp foreach asphp doreachhow to excute eache arrey value phpfor loop through array phpforeach 24loop phpphp loop variablehow to do a foreach for array in phpphp foreach in arrayphp loop on arrayhow to set time for foreach looping time in phpforeach as 3d 3e key phpphp loop through std arrayphp foreach in 4 loopget only values from foreach phpforeach 3a phpphp loop within arrayfor loop on array phpsql php foreachneed to iterate through each key in foreach looparray iterate phpphp for each echouse of lopp in phpforeach php 7string to array for loop phpiterate trhough arrya phphphp foreach in foreachloop trough array php for phhp foreachlooping throught array 28 29 phpphp loop array thru arrayphp loop through array with for loophow to make loop on array in phpphp array traverse to second keyphp array make each an arrayforeach key valueiterate array index phpphp list foreachphp for each looploop on array in phpforeach key 3d 3e 24value phpfor each loop phpphp loop through post arrayfor item in list phpphp walk associative arrayloop inside array phpiterating through an array phpphp loop foreach loop all data in an array in php foeach phpforeach with key phpphp array iterate over existing elementsfphp foreachphp for each keyfor loop program in php with arrayhow to do a for loop with an array in phpiterate over array phpconcept of array with loop using in phpforeack loop with arrya phpphp foreach inphp 21 3d foreachphp froeach asphp foreach examplefor loop array phpohow to iterate through a list in phpmake array in php looploop through loop through array php using length for loophow to put a foreach in a function phphow to loop through php to javascript arrayforeach loop in an arayhow to map each key to all row in a loop using phpforech loop for array in phpfor each php arraycreate array in loop phpforeach on array phpphp iterate through array of stringsphp foreach without iteratorhow to iterate through a list phparray loop in phpfor loop array phpphp looping arrayphp foreach object listlaravel array value used in for eachphp foreach array keyforeeach phpphp foreach listfor loop array in phpphp array loop tableforeach with reference phploop on a array phpfunciont similar foreach php 5cfor each pjpforeach loop in php syntaxloop html in php using arrayphp 5 array foreachhow to loop through an array php 24loop for each phpphp array loop ast valuemake simple array php loopforeach array key value phpphp foreach i 1 to 20foreacho in phparray in for loop in phploop over array in phploop array php stringphp array and foreach key valueforelse phpforeach multipliving in phpphp forloopphp iterate over array in whilephp for for eachlooping through an array phpforeach list phpphp for loop for arrayloop all data phploop key value array phpforeach for 5b array 5d in phpphp foreacloop to arrays phpphp loop through array of arraysphp loop through array