YAPC::EU 2018 Glasgow Update!
This commit is contained in:
parent
22f33d4004
commit
4e2d22a71d
1170 changed files with 15042 additions and 3047 deletions
23
Task/Strip-block-comments/PHP/strip-block-comments.php
Normal file
23
Task/Strip-block-comments/PHP/strip-block-comments.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
function strip_block_comments( $test_string ) {
|
||||
$pattern = "/^.*?(\K\/\*.*?\*\/)|^.*?(\K\/\*.*?^.*\*\/)$/mXus";
|
||||
return preg_replace( $pattern, '', $test_string );
|
||||
}
|
||||
|
||||
echo "Result: '" . strip_block_comments( "
|
||||
/**
|
||||
* Some comments
|
||||
* longer comments here that we can parse.
|
||||
*
|
||||
* Rahoo
|
||||
*/
|
||||
function subroutine() {
|
||||
a = /* inline comment */ b + c ;
|
||||
}
|
||||
/*/ <-- tricky comments */
|
||||
|
||||
/**
|
||||
* Another comment.
|
||||
*/
|
||||
function something() {
|
||||
}
|
||||
" ) . "'";
|
||||
Loading…
Add table
Add a link
Reference in a new issue