Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Short syntax for PHP command line I/O streams
<?php
while(!feof(STDIN)){
$line = trim(fgets(STDIN));
if(strlen($line) > 0){
fwrite(STDOUT,strrev($line).PHP_EOL);
} else {
fwrite(STDERR,"An empty line was passed".PHP_EOL);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.