I’m trying to achieve the following
I have post data which is an array[]
I’m using a foreach to run through the array
foreach($images as $image){
update_option( 'image-'. $mycounter .'', $image );
}
I need $mycounter to be counting as it runs through the foreach. How can I achieve that. I tried it with a while loop but not working 🙁
Thanks
You could use the incrementing operator:
OR use the unique numerical indices as your counter, assuming the indices are numerical.