PHP getting values from an array with even keys? -


Is the easiest way to loop through the values ​​of an array using a forshak, but even here So even the keys are also targeting, for example an array like this:

  [0] = & gt; Val [1] = & gt; Val 1 [2] = & gt; Val 2 [3] = & gt; Val 3 [4] = & gt; Val4   

etc ...

How can I just loop through keys without the keys such as 0, 2 and 4?

Thanks in advance :)

In your foreach you can also get the key Are you just checking whether or not? / P>

  foreach (dollar array as $ key => gt; $ value) {if ($ key% 2! = 0) // key is uneven, release; // your stuff}    

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? -