Skip to content
Advertisement

Tag: filenames

After changing name of a file it goes parent directory

I’m writing a PHP code that takes names from input.txt file and with those names it changes the names of files in the image folder. My code is: It works but at last, files in the ‘image’ folder go C:wamp64wwwReplace image names with input directory. (Parent directory) Any idea why this happens? Answer To make it more clear. Here is

Search array of filenames for file ending with “.txt”

I have an array with filenames. I want to check if the array have a file with extension ‘.txt’. How can I do that? in_array only checks for a specific value. Answer Contrarily to other answers suggesting array_filter, I don’t return something. I just check if it exists in the array. Besides, this implementation is more efficient than array_filter because

Advertisement