Hi all. I'm in the midst of my ongoing efforts to understand php. I've been analyzing a script and trying to understand everything it's doing from top to bottom. Last night, I noticed it was using a function called 'cut' but I can't find anything on it online. If I'm guessing right, it's cutting the part at description to the end description tag for the $item.. but it just seems odd that I can't find anything online. $description=cut("<description>","</description>",$lineitem); Code (markup): preg_match looks like it would typically be used for this.. but why am I not finding anything on cut? Am I just missing it?? Thanks!
This is not a built in PHP function, but rather a user specific function that whomever created the script came up with (which is what Dan was implying). This usually means no documentation except understanding the function itself. If you look around in your files, you will find the declaration for it: function cut(params) { }
I think it's bad practice to redefine functions something like "cut" that appears to do what's already built in. It's also much faster for PHP to use built-in functions rather than defining our own, since they are written in C vs PHP having to parse ours. You may need to check the rest of the code where this bloke created a function cut(), bad practice if you ask me :\
lol.. I think I have to agree! But.. the good news is that is was an unused function. I searched the rest of the code and it was never called so it all worked out. I'm still so new to php but I just love it. Such fun!