Jump to content

[SOLVED] strreplace


jesushax

Recommended Posts

i know how to use the following function but was wondering what any of you would suggest for a quick method

 

when i upload files i save the file type and then call the file type when viewign them and they come out like below

 

i want to change

 

application/msword TO Word Document

application/pdf TO PDF Document

image/pjpeg TO Image File

 

now i know the long way to do this, would be to have if statements then ouptut the answer in a variable but can anyone offer a quicker neater solution?

 

Cheers

 

 

Link to comment
https://forums.phpfreaks.com/topic/109405-solved-strreplace/
Share on other sites

you can use an array then use array_search. Keep in mind array_search will return the key not the value.

 

<?php
$array = array("Word Document" => "application/msword", "PDF Document" => "application/pdf");
$type = "application/msword";

$doc = array_search($type, $array);
echo $doc;
?>

 

Ray

 

Link to comment
https://forums.phpfreaks.com/topic/109405-solved-strreplace/#findComment-561184
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.