Skip to content

Instantly share code, notes, and snippets.

@cronfy
Forked from peterjaap/convertShortOpenTags.sh
Last active September 26, 2017 16:33
Show Gist options
  • Save cronfy/a26cc8670be8aab3deee956159e6cf8e to your computer and use it in GitHub Desktop.
Save cronfy/a26cc8670be8aab3deee956159e6cf8e to your computer and use it in GitHub Desktop.
PHP: Replace short open tag <? with full form <?php
# Uncomment last line if you want to replace <?= with <?php echo
find . -type f -iname '*.php' -print0 |
xargs -0 sed -i \
-e 's/<? /<?php /g' \
-e 's/<?$/<?php/' \
-e 's/<?\/\//<?php \/\//g' \
-e 's/<?\/\*/<?php \/\*/g' \
# -e 's/<?\=/<?php echo /g'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment