the function reads the comment added after the function is called using a backtrace and uses them as arguments
How marvelously creative. What an abomination.
Welcome to /c/php! This is a community for PHP developers and enthusiasts to share and discuss anything related to PHP. From the latest updates and tutorials, to your burning questions and amazing personal projects, we welcome all contributions.
Let's foster an environment of respect, learning, and mutual growth. Whether you're an experienced PHP developer, a beginner, or just interested in learning more about PHP, we're glad to have you here!
Let's code, learn, and grow together!
the function reads the comment added after the function is called using a backtrace and uses them as arguments
How marvelously creative. What an abomination.
No, my eyes! Forever unclean!
Do you really want an answer for that?
What a terrible day to have eyes
no. never wanted that.
This reminds me of a trick to get multiline strings in javascript before they where formally introduced. If you coerce a function in to a string you get the source code for that function, comments and all. This meant that you could write a function with multiline comments and then pick out the middle part. Haven't tested it so it's probably sligthly wrong but it was something like:
var multiLine = ('' + function () {/*
line 1
line 2
*/});
multiLine = multiLine.substring(16, multiLine.length-4);
huh, that does look kinda clean though
@chrastecky @php eh, cože? proč?