Skip to content
View pipe.php
<?php
$phase1Result = array_filter($input, function($item) { .... });
$phase2Result = array_map(function($item) use ($ex1, $ex2) {
.... do something
}, $phase2Result);
$phase3Result = array_map(function($item) use ($a1, $a2) {
.... do something
}, $phase3Result);
// 組合在一起
View mock.php
<?php
$houseWork = new HouseWork;
$originalMethod = mock($houseWork, "GetToday", function() {
// $this works here.
$date = new DateTime;
$date->setDate(2016, 4, 16);
return $date;
});
$houseWork->WhoShouldWork();
unmock($houseWork, $originalMethod);
View getter.php
<?php
class StatusGetter {
protected $status;
public function __construct($status) {
$this->status = $status;
}
View benchmark.php
<?php
require 'vendor/autoload.php';
class User {
public $name;
public function __construct($name) {
$this->name = $name;
}
View after.txt
simple 0.156
simplecall 0.047
simpleucall 0.154
simpleudcall 0.174
mandel 0.754
mandel2 0.872
ackermann(7) 0.158
ary(50000) 0.021
ary2(50000) 0.017
ary3(2000) 0.403
View obj-poly.php
<?php
interface Intf {
public function getA();
}
class MyFoo implements Intf {
public $a;
public function getA() {
return $this->a;
}
View obj.php
<?php
class A {
protected $bar;
public function getBar() {
return $this->bar;
}
}
View -
#!/bin/bash
set -e
# https://github.com/hhvm/homebrew-hhvm/blob/master/hhvm.rb
prefix=/opt/local
# find . -type f -iname "CMakeCache.txt" -delete
# find . -type d -iname "CMakeFiles" | xargs -I{} rm -rf {}
# git submodule update --recursive --force --init
# -DCMAKE_BUILD_TYPE=Debug \
cmake . \
-Wno-dev \
View gist:d149b975711559158c40
- C 語言
- Data Type
- Function
- Stack && Heap Memory
- PHP Extension
- How Extension Works?
- Basic Skeleton
- Build!
- Adding Functions
- Parsing parameters
View bench-master.txt
simple 0.155
simplecall 0.058
simpleucall 0.142
simpleudcall 0.164
mandel 0.729
mandel2 0.709
ackermann(7) 0.149
ary(50000) 0.021
ary2(50000) 0.017
ary3(2000) 0.413
Something went wrong with that request. Please try again.