added new function to pHP helper to get item index