Skip to content

Instantly share code, notes, and snippets.

@carlosleonam
Last active January 25, 2020 17:49
Show Gist options
  • Save carlosleonam/58e82d7d197b7256ac09b7e9e73f59ec to your computer and use it in GitHub Desktop.
Save carlosleonam/58e82d7d197b7256ac09b7e9e73f59ec to your computer and use it in GitHub Desktop.
PHP snippets to use in VS code ( with extension PHP Awesome Snippets [https://github.com/h4kst3r/php-awesome-snippets] )
{
"<?php If ... endif": {
"prefix": "pifen",
"body": [
"<?php if (${1:condition}): ?>",
"\t${0:<!-- coding here -->}",
"<?php endif; ?>"
],
"description": "If endif block inside HTML"
},
"<?php If ... else ... endif": {
"prefix": "pifelen",
"body": [
"<?php if (${1:condition}): ?>",
"\t${2:<!-- coding here -->}",
"<?php else: ?>",
"\t${0:<!-- coding here -->}",
"<?php endif ?>;"
],
"description": "If else endif block"
},
"<?php If ... elseif ... else ... endif": {
"prefix": "pifelifen",
"body": [
"<?php if (${1:condition}): ?>",
"\t${2:<!-- coding here -->}",
"<?php elseif (${3:condition}): ?>",
"\t${4:<!-- coding here -->}",
"<?php else: ?>",
"\t${0:<!-- coding here -->}",
"<?php endif; ?>"
],
"description": "If elseif else endif block"
},
"<?php If block": {
"prefix": "pifb",
"body": [
"<?php if (${1:condition}) { ?>",
"\t${0:<!-- coding here -->}",
"<?php } ?>"
],
"description": "If block"
},
"<?php If ... else": {
"prefix": "pifel",
"body": [
"<?php if (${1:condition}) { ?>",
"\t${2:<!-- coding here -->}",
"<?php } else { ?>",
"\t${0:<!-- coding here -->}",
"<?php } ?>"
],
"description": "If else block"
},
"<?php If ... elseif ... else": {
"prefix": "pifelif",
"body": [
"<?php if (${1:condition}) { ?>",
"\t${2:<!-- coding here -->}",
"<?php } elseif (${3:condition}) { ?>",
"\t${4:<!-- coding here -->}",
"<?php } else { ?>",
"\t${0:<!-- coding here -->}",
"<?php } ?>"
],
"description": "If elseif else block"
},
"<?php Ternary operator": {
"prefix": "ptern",
"body": [
"<?php ${1:condition} ? ${2:if_true} : ${3:if_false}; ?>"
],
"description": "Ternary statement"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment