This file contains 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 | |
trait TraitTest { | |
public function sayHello(){ | |
echo "Hello!"; | |
} | |
} | |
class Test { | |
use TraitTest; |
This file contains 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 | |
trait Hello { | |
public function hello(){ | |
echo "hello\n"; | |
} | |
} | |
trait World { |
This file contains 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 | |
trait Hello { | |
public function hello(){ | |
echo "hello\n"; | |
} | |
} | |
trait World { |
This file contains 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 | |
interface IListener { | |
public function notify(); | |
} | |
class HogeListener implements IListener{ | |
public function notify(){ | |
echo "HogeHoge!!\n"; | |
} |
This file contains 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 | |
$array1 = [1,2,3,4,5,]; | |
$array2 = ["key1" => "value1", "key2" => "value2",]; | |
$array3 = [1,2,3,4,"key3" => "value3",]; | |
print_r($array1); |
This file contains 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 | |
function mb_insertstr_per_charwidth($str, $width, $insert, $encode){ | |
$buf = ""; | |
$lines = array(); | |
for($i=0; $i<mb_strlen($str, $encode); $i++){ | |
$char = mb_substr($str, $i, 1, $encode); | |
if(mb_strwidth($buf . $char, $encode) <= $width){ | |
$buf .= $char; |
This file contains 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 | |
/** | |
* 環境に依存しない文字列のバイト数取得関数 | |
*/ | |
function getByteCount($str){ | |
return strlen(bin2hex($str)) / 2; | |
} |
This file contains 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 | |
/** | |
* ClassBuilder::startBuild("Person") | |
* ->addProperty("protected", "name") | |
* ->addProperty("protected", "age") | |
* ->addProperty("protected", "gender") | |
* ->addMethod("public", '__construct($name, $age, $gender)', | |
* '$this->name = $name;' | |
* . '$this->age = $age;' | |
* . '$this->gender = $gender;' |
This file contains 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 | |
/** | |
* 秒数 -> array({日数}, {時間数}, {分数}, {秒数}) 形式に変換する関数 | |
*/ | |
function convertToDHMS($sec) { | |
$day = floor($sec / 86400); | |
$hour = floor($sec / 3600) % 24; | |
$minute = floor($sec / 60) % 60; | |
$second = $sec % 60; |
This file contains 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
package controllers; | |
import play.mvc.Controller; | |
import play.mvc.Result; | |
public class Echo extends Controller { | |
public static Result echo(String mes){ | |
return ok(mes); | |
} |
OlderNewer