構文 | 意味 | 例 |
---|---|---|
array | 配列リテラル | array(1, 2) |
die | PHPスクリプトの終了 | foo() or dir(1); |
echo | 文字列を標準出力 | echo $message, PHP_EOL; |
empty | 値/変数が「空」または「偽」かの検査 | if (empty($v) || empty($a['i'])) |
eval | 文字列をPHPスクリプトとして評価 | eval($s) |
exit | PHPスクリプトの終了 | exit(0); |
include、include_once | PHPスクリプトの読み込み | include_once __DIR__ . '/Foo.php'; |
isset | 値/変数が存在するかの検査 | $v = isset($a['i']) ? $a['i'] : 's'; |
I, the contributor, agree to licence my contributions to Baguette PHP project under the terms of the GPL 3.0 and any later version, and to license my contributions to the documentation of the Baguette PHP project under the terms of the Creative Commons Attribution-ShareAlike 4.0 International license.
I hereby claim:
- I am zonuexe on github.
- I am tadsan (https://keybase.io/tadsan) on keybase.
- I have a public key ASBfDNiVJL5ZgMARmLbUlFta8QSry5Nxn1uh2b-Maonhawo
To claim this, I am signing this object:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Copyright (c) 2017 USAMI Kenta <[email protected]> | |
# @author tadsan | |
# @license GPL-3.0 | |
# This program comes with ABSOLUTELY NO WARRANTY; | |
# This is free software, and you are welcome to redistribute it | |
# under certain conditions; type `tsd version' for details. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var newStyle = document.createElement('style'); newStyle.type = "text/css"; | |
document.getElementsByTagName('head').item(0).appendChild(newStyle); | |
var css = document.styleSheets.item(0); | |
css.insertRule(".__pixelart{ image-rendering: pixelated }", 0); | |
var x = Array.prototype.map.call(document.querySelectorAll('.Item'), function(i){ | |
var t = i.querySelectorAll('.ItemText a'); | |
var isPixelArt = !!Array.prototype.filter.call(t, function(v){ return /ドット|dot|pixel/.test(v.innerText); }).length; | |
var isIronbeads = !Array.prototype.filter.call(t, function(v){ return /アイロンビーズ/.test(v.innerText); }).length; | |
if (isPixelArt && !isIronbeads) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include_once getenv('HOME') . '/.composer/vendor/autoload.php'; | |
use PhpParser\Node; | |
use PhpParser\NodeTraverser; | |
use PhpParser\NodeVisitorAbstract; | |
use PhpParser\ParserFactory; | |
use PhpParser\PrettyPrinter; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-*- coding: utf-8 -*- | |
def fb(n): | |
s = "" | |
if (n % 3 == 0): | |
s += "Fizz" | |
if (n % 5 == 0): | |
s += "Buzz" | |
if (s == ""): | |
s = str(n) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# EditorConfig is awesome: http://EditorConfig.org | |
# top-most EditorConfig file | |
root = true | |
# Unix-style newlines with a newline ending every file | |
[*] | |
end_of_line = lf | |
insert_final_newline = true | |
charset = utf-8 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
var_dump(PHP_SAPI); | |
pcntl_signal(SIGALRM, function () { | |
var_dump("おしまい", time()); exit; | |
}); | |
// 2秒後にセット | |
pcntl_alarm(2); | |
$i = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* printf is template engine | |
* | |
* @license WTFPL http://www.wtfpl.net/ | |
* @author USAMI Kenta <[email protected]> | |
* @param string $format | |
* @param string|int|float $args... | |
* @return string |