@ 2024-07-18T23:08:07Z <?php
const MADNESS = <<<EOM
<?php
yield // this comment doesn't make sense, but hey, why not?
/* the blank line above doesn't make sense either, as well as this comment */
/* and thinking about it – */ // why not go batshit crazy with this? /* he */
from gen2();
EOM;
$comments = token_get_all("<?php" . substr(token_get_all(MADNESS)[2][1], 5, -4));
array_shift($comments); // drop <?php
var_dump($comments);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.4.1 - 8.4.12 array(8) {
[0]=>
array(3) {
[0]=>
int(391)
[1]=>
string(53) "// this comment doesn't make sense, but hey, why not?"
[2]=>
int(1)
}
[1]=>
array(3) {
[0]=>
int(396)
[1]=>
string(6) "
"
[2]=>
int(1)
}
[2]=>
array(3) {
[0]=>
int(391)
[1]=>
string(77) "/* the blank line above doesn't make sense either, as well as this comment */"
[2]=>
int(3)
}
[3]=>
array(3) {
[0]=>
int(396)
[1]=>
string(6) "
"
[2]=>
int(3)
}
[4]=>
array(3) {
[0]=>
int(391)
[1]=>
string(31) "/* and thinking about it – */"
[2]=>
int(5)
}
[5]=>
array(3) {
[0]=>
int(396)
[1]=>
string(1) " "
[2]=>
int(5)
}
[6]=>
array(3) {
[0]=>
int(391)
[1]=>
string(47) "// why not go batshit crazy with this? /* he */"
[2]=>
int(5)
}
[7]=>
array(3) {
[0]=>
int(396)
[1]=>
string(6) "
"
[2]=>
int(5)
}
}
Output for 8.3.1 , 8.3.3 , 8.3.5 - 8.3.6 , 8.3.8 , 8.3.10 , 8.3.12 , 8.3.14 , 8.3.16 , 8.3.18 - 8.3.19 , 8.3.21 , 8.3.23 - 8.3.25 array(8) {
[0]=>
array(3) {
[0]=>
int(387)
[1]=>
string(53) "// this comment doesn't make sense, but hey, why not?"
[2]=>
int(1)
}
[1]=>
array(3) {
[0]=>
int(392)
[1]=>
string(6) "
"
[2]=>
int(1)
}
[2]=>
array(3) {
[0]=>
int(387)
[1]=>
string(77) "/* the blank line above doesn't make sense either, as well as this comment */"
[2]=>
int(3)
}
[3]=>
array(3) {
[0]=>
int(392)
[1]=>
string(6) "
"
[2]=>
int(3)
}
[4]=>
array(3) {
[0]=>
int(387)
[1]=>
string(31) "/* and thinking about it – */"
[2]=>
int(5)
}
[5]=>
array(3) {
[0]=>
int(392)
[1]=>
string(1) " "
[2]=>
int(5)
}
[6]=>
array(3) {
[0]=>
int(387)
[1]=>
string(47) "// why not go batshit crazy with this? /* he */"
[2]=>
int(5)
}
[7]=>
array(3) {
[0]=>
int(392)
[1]=>
string(6) "
"
[2]=>
int(5)
}
}
Output for 8.3.0 , 8.3.2 , 8.3.4 , 8.3.7 , 8.3.9 , 8.3.11 , 8.3.13 , 8.3.15 , 8.3.17 , 8.3.20 , 8.3.22 array(8) {
[0]=>
array(3) {
[0]=>
int(392)
[1]=>
string(53) "// this comment doesn't make sense, but hey, why not?"
[2]=>
int(1)
}
[1]=>
array(3) {
[0]=>
int(397)
[1]=>
string(6) "
"
[2]=>
int(1)
}
[2]=>
array(3) {
[0]=>
int(392)
[1]=>
string(77) "/* the blank line above doesn't make sense either, as well as this comment */"
[2]=>
int(3)
}
[3]=>
array(3) {
[0]=>
int(397)
[1]=>
string(6) "
"
[2]=>
int(3)
}
[4]=>
array(3) {
[0]=>
int(392)
[1]=>
string(31) "/* and thinking about it – */"
[2]=>
int(5)
}
[5]=>
array(3) {
[0]=>
int(397)
[1]=>
string(1) " "
[2]=>
int(5)
}
[6]=>
array(3) {
[0]=>
int(392)
[1]=>
string(47) "// why not go batshit crazy with this? /* he */"
[2]=>
int(5)
}
[7]=>
array(3) {
[0]=>
int(397)
[1]=>
string(6) "
"
[2]=>
int(5)
}
}
Output for 8.1.0 - 8.1.33 , 8.2.0 - 8.2.29 array(0) {
}
preferences:dark mode live preview ace vim emacs key bindings
76.03 ms | 413 KiB | 5 Q