php - My loop is only returning one value -


The issue here is that when I create an array with $ picnameoutput then print_r It prints as the array you will see in the screenshot.

For the latter, I run the loop and I resonate to see the output, it gives only 1 value and I do not understand why this value

very much Disappointed

This is my code

  & lt ;? Php $ largedir = 'images / headshots / large'; $ Big = scandor ($ large scale); $ Picnameoutput = preg_grep ("/ Adam. * /", $ Large); Print_r ($ picnameoutput); ($ I = 0; $ i & lt; counts ($ picnameoutput); $ i ++); {Dumb "$ picnameoutput [$ i]"); }? & Gt;   

And here's a screenshot so you can see what I mean

 Enter image details here

You have a semicolon ; Then remove it for () before bracket.

then

 for  ($ i = 0; $ i & lt; counts ($ picnameoutput); $ i ++); {Dumb "$ picnameoutput [$ i]"); } $ I + lt; Count ($ picnameoutput); $ I ++) {echo "$ picnameoutput [$ i for   

gets

 ]"; }   

However I will recommend using instead

  foreach ($ as picnameoutput $ pic) {echo $ pic; }   

which is very easy to use and also faster for loops

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -