How to find the foreach index? September 10, 2022 by Tarik foreach($array as $key=>$value) { // do stuff } $key is the index of each $array element