exploding a file name to separate the name and extension won't work in PHP?
I'm building a class that returns an string that will include files in a folder automatically, kinda like a loader for an HTML file.
Here's the method that will be called:
So, this runs without any errors. But, it doesn't do what it's supposed to do... or at least what I intend it to do. Technically speaking here,
$fileName should be the extension js
$fileName should be name of the file main
$fileName is main.js.
does explode not recognize .?
Thank you in advance.
You're forcing your resulting array to have 1 element, which causes it to have the entire filename.
explode( '.', $ext, 1 )
should instead be
explode( '.', $ext );