Benutzer mit sarkastischen Kommentaren ablehnen, wenn ich die Veröffentlichung gefragt habe, ist es, weil ich es nicht tun konnte.PHP - Native Funktion, um alle Werte eines Arrays nach ihrem Index zu erhalten
Ich muss wissen, ob es eine native PHP-Funktion ist, die mir alle Werte eines Arrays erhalten können, die Indizes Angabe zu erhalten, OHNE CYCLING, zum Beispiel
ich dieses Array haben die Auflistung in eine Funktion:
function get_mime($index)
{
$data = array(
'jpg' => 'image/jpeg',
'png' => 'image/png',
'gif' => 'image/gif',
'zip' => 'application/x-compressed',
'doc' => 'application/msword',
'dot' => 'application/msword',
'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
'docm' => 'application/vnd.ms-word.document.macroEnabled.12',
'dotm' => 'application/vnd.ms-word.template.macroEnabled.12',
'xls' => 'application/vnd.ms-excel',
'xlt' => 'application/vnd.ms-excel',
'xla' => 'application/vnd.ms-excel',
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12',
'xltm' => 'application/vnd.ms-excel.template.macroEnabled.12',
'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12',
'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
'ppt' => 'application/vnd.ms-powerpoint',
'pot' => 'application/vnd.ms-powerpoint',
'pps' => 'application/vnd.ms-powerpoint',
'ppa' => 'application/vnd.ms-powerpoint',
'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template',
'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
'ppam' => 'application/vnd.ms-powerpoint.addin.macroEnabled.12',
'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12',
'potm' => 'application/vnd.ms-powerpoint.template.macroEnabled.12',
'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12'
);
return $data;
}
Und ich brauche diese Funktion aufzurufen:
get_mime(array('jpg', 'png', 'gif'));
Und ein Array mit Werten zurück:
array('image/jpeg', 'image/png', 'image/gif')
Wichtig: ich ohne Zyklen dies mit einer nativen PHP-Funktion tun möchten.
Vielen Dank für Ihre Hilfe.
Haben Sie versucht, über Funktionen zu lesen, die ich Ihnen ponted? – splash58
Benutzer mit sarkastischen Kommentaren zurückhalten, wenn ich die Veröffentlichung gefragt habe, weil ich es nicht tun konnte. –
1) Warum. 2) Glauben Sie, dass "native" Funktionen keine Schleifen ausführen? –