2
0
mirror of https://github.com/webgefrickel/dotfiles synced 2024-11-15 12:12:58 +00:00
steffen-dotfiles/nvim/snippets/php.snippets

161 lines
1.9 KiB
Plaintext
Raw Normal View History

snippet arr
$${1:array} = ['${2}' => ${3}];
endsnippet
snippet if
if (${1:condition}) {
${2}
}
endsnippet
snippet if2
<?php if (${1:condition}): ?>
${2}
<?php endif ?>
endsnippet
snippet ife
if (${1:condition}) {
${2}
} else {
${3}
}
endsnippet
snippet ife2
<?php if (${1:condition}): ?>
${2}
<?php else: ?>
${3}
<?php endif ?>
endsnippet
snippet else
else {
${0}
}
endsnippet
snippet else2
<?php else: ?>
endsnippet
snippet for
for ($${1:i} = 0; $1 < ${2:$count}; $$1 += 1) {
${3}
}
endsnippet
snippet for2
<?php for ($${1:i} = 0; $1 < ${2:$count}; $$1 += 1): ?>
${3}
<?php endfor ?>
endsnippet
snippet fek
foreach ($${1:variable} as $${2:key} => $${3:value}) {
${4}
}
endsnippet
snippet fek2
<?php foreach ($${1:variable} as $${2:key} => $${3:value}): ?>
${4}
<?php endforeach ?>
endsnippet
snippet fe
foreach ($${1:variable} as $${2:value}) {
${3}
}
endsnippet
snippet fe2
<?php foreach ($${1:variable} as $${2:value}): ?>
${3}
<?php endforeach ?>
endsnippet
snippet get
$_GET['${0}']
endsnippet
snippet post
$_POST['${0}']
endsnippet
snippet sess
$_SESSION['${0}']
endsnippet
snippet inc
include '${0:filename}.php';
endsnippet
snippet req
require '${0:filename}.php';
endsnippet
snippet t
$${1:var} = (${2:condition}) ? ${3} : ${4};
endsnippet
snippet cl
echo '<pre>' . var_dump(${0:var}) . '</pre>';
endsnippet
snippet bug
echo '<pre>' . var_dump(${0:var}) . '</pre>';
endsnippet
snippet fun
function ${1:name}(${2:$param}) {
${3}
}
endsnippet
snippet cls
class ${1:Class} {
public function __construct(${2:$options}) {
${3}
}
}
endsnippet
snippet ph
<?php
${0}
endsnippet
snippet phi
<?php ${0} ?>
endsnippet
snippet <?
<?php
${0}
?>
endsnippet
snippet ==
<?= ${0} ?>
endsnippet
snippet sw
switch (${1:expression}) {
case '${2:case}':
${3}
break;
default:
${4}
break;
}
endsnippet
snippet case
case '${1:case}':
${2}
break;
endsnippet