<?php

$logfile="php://stdin";//output => php://stdout
$cp = fopen($logfile, "r");// 讀寫模式, 指標於最後, 找不到會嘗試建立檔案
$tmp= fgets($cp);
fclose($cp);//關閉檔案要求
$argv=explode(" ",$tmp);
$argc=count($argv);

$regex = '/卡拉\w+可夫/u';
for ($i = 0; $i < $argc; $i++) {
	$mres = preg_match($regex, $argv[$i], $matches);
    echo "preg_match claims {$mres} match for $regex in {$argv[$i]}\n";
    print_r($matches);
}