How would I get an array position in php?
I have an array:
$arr = array("mp3", "wma");
and a for loop:
for($i = 0; $i < count($_FILES); $i++ ) {
{
$_POST['extention_file'.$i] = pathinfo($_FILES[ 'file'.$i]['name'], PATHINFO_EXTENSION); // getting file extension here
// i know this in java script:
// flag_extFile = file.name.split(".").pop();
// flag_extFile = flag_extFile.toLowerCase();
// flag_extCheck = arr.indexOf(flag_extFile);
// alert(flag_extCheck); we will get array index here.
// how we can do the same functionality in php
}
How can I achieve this in php?
Edited:
I need the result without using a foreach loop or any other loop. In JavaScript I could write arr.indexOf(flag_extFile);, I need the same thing in php.
how can i achieve this in phpWhat doesthisrefer to here?