php class IOStream public endl public function cout text echo this- is

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
class IOStream {
public $endl = "\n";
public function cout($text){
echo $this->isWin() ? $this->toCP866($text) : $text;
}
public function cin($var){
global ${$var};
${$var} = $this->isWin() ? $this->fromCP866(trim(fgets(STDIN))) : trim(fgets(STDIN));
}
public function isWin(){
return DIRECTORY_SEPARATOR == "\\" ? true : false;
}
public function toCP866($text){
return iconv("UTF-8", "CP866", $text);
}
public function fromCP866($text){
return iconv("CP866", "UTF-8", $text);
}
}
?>