tags - What is the correct way to comment out a PHP variable being echoed using shorthand notation? -
i have started using php shorthand <?= ?> tags echo variables etc in php scripts. find if want comment out variable, e.g. <?= //$myvariable; ?> syntax error.
is safe this: <?//= $myvariable; ?>
many thanks!
the short tag
<?= ... ?> is translated into
<?php echo ...; ?> so comment out, have set ... shows empty. here's shortest can come with:
<?= false && ... ?> this works because echo false echoes nothing.
there's no documentation supporting it, might old compatibility hack, next seem work:
<?//= ... ?> and
<?/*= ... */?> since they're undocumented, wouldn't depend on them important, utilize them if you're temporarily commenting out while debugging.
php tags comments
No comments:
Post a Comment