Jump to content

Removing every second value and key from an array


Recommended Posts

HelloI have this array:

Array(40) [0]=> widget [1]=> debug [2]=> on [3]=> window [4]=> title [5]=> Sample Konfabulator Widget [6]=> name [7]=> main_window [8]=> width [9]=> 500 [10]=> height [11]=> 500	 [12]=> image [13]=> src [14]=> Images/Sun.png [15]=> name [16]=> sun1 [17]=> hOffset [18]=> 250 [19]=> vOffset [20]=> 250 [21]=> alignment [22]=> center	 [23]=> text [24]=> data [25]=> Click Here [26]=> size [27]=> 36 [28]=> style [29]=> bold [30]=> name [31]=> text1 [32]=> hOffset [33]=> 250 [34]=> vOffset [35]=> 100 [36]=> alignment [37]=> center [38]=> onMouseUp [39]=> sun1.opacity = (sun1.opacity / 100) * 90;

The output above is from my PHP inspired var_dump() functionHow do i remove every other key from it, beginning with [1]debugI can't seem to wrap my head around it at the moment :)Any suggestions are welcome./mads

Link to post
Share on other sites

I don't use VB, but that might not matter. If I understand the problem, the solution is to work from the end of the array, not the beginning. That way the indexes stay the same as you work toward 0. HTH

Edited by Deirdre's Dad
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...