Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.
Does anybody know where I can view the core code of a specific PHP function?
The PHP manual on is_file() says: "is_file — Tells whether the filename is a regular file". What do they mean by "regular file"?
I would like to see the implementation of the is_file() function (it is written in C if memory serves...).
I believe all they mean by "regular file" is that it is in fact a file and not a directory. I will also return true if the file is a symbolic link that points to a file.
I think they say "regular file" because the file_exists() function works on both files and directories.
Yes, it is a file. It's data contains the path to that of the linked file - the OS recognises this and thus it appears as a shortcut. Much like the Windows ".lnk" files appear as shortcuts, this is what a symbolic link is.
a Hard linked file is what does not appear as it's own file, as that is actually a shared inode, not a 'redirect' as symlinks are.
Thanks Buddha443556, dreamscape, Jenk and astions, thanks guys.
I did not find it, but I don't think I need it anymore, your help was enough so I don't need to see the core code.
With that said, if someone has already found it, I won't mind see the code.
Oren wrote:
With that said, if someone has already found it, I won't mind see the code.
It's in ext/standard/filestat.c file, is_file is expanded using FileFunction macro which calls the php_stat function which deep inside of it calls the php_stream_stat_path_ex and then uses the following macro to check if the file is regular: