PHP - Split the string "example.jpg" into two variables, $name (example) and $format (.jpg) -
I would like to name the image and divide it into two different strings that are related to its actual name and its file format . For example, say
for example:
I have to show an output like this: What is the best way to use PHP? Any advice, suggestions or input will be greatly appreciated! I know that this is going to get the RTM responses, but if you do not know how you really want to start, then this is not an easy task to find the right thing That's why I think the "best" solution that I think is more of this work. Ref: example.jpg
eca $ name; // Output "example" $ format; // outputs ".jpg"
& lt; Php $ Path_parts = pathinfo ('example.jpg'); $ Path_parts ['dirname'] echo, "\ n"; Echo $ path_parse ['basename'], "\ n"; Replace $ Path_parts ['Extension'], "\ n"; $ Path_parts ['filename'], "\ n"; // PHP 5.2.0? & Gt;
Comments
Post a Comment