Skip to content

Instantly share code, notes, and snippets.

@pjyong
pjyong / read.php
Created September 23, 2016 07:26
使用多线程,从中石化导出的数据提取出柴油
<?php
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
$threads = array();
for($i = 1;$i <= 3; $i++){
// 开启一个线程
$threads[$i] = new Handler($i);
$threads[$i]->start();
}
@pjyong
pjyong / test_thread_join.php
Created September 22, 2016 09:02
Test the difference of "join" and without "join"
<?php
class CounterThread extends Thread {
public function run() {
for ($i = 0; $i < 10; $i++){
echo "Main thread:".$i."\n";
}
}
}
$firstThread = new CounterThread();
for($i = 0;$i <20; $i++){