This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$stdin = fopen('php://stdin', 'r'); | |
$stdout = fopen('php://stdout', 'w'); | |
$stderr = fopen('php://stderr', 'w'); | |
while(!feof($stdin)){ | |
$line = trim(fgets($stdin)); | |
if(strlen($line) > 0){ | |
fwrite($stdout,strrev($line).PHP_EOL); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ php -s test.phps | |
<code><span style="color: #000000"> | |
<span style="color: #0000BB"><?php<br /></span><span style="color: #007700">if(</span><span style="color: #0000BB">$_REQUEST</span><span style="color: #007700">[</span><span style="color: #DD0000">'a'</span><span style="color: #007700">] == </span><span style="color: #DD0000">'b'</span><span style="color: #007700">){<br /> echo </span><span style="color: #DD0000">'Some output'</span><span style="color: #007700">;<br />}<br /></span> | |
</span> | |
</code> | |
$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
highlight_string('<?php echo "A line of PHP code a day keeps the doctor away";'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Echo directly | |
highlight_file('test.php'); | |
//Store in variable first | |
$source = highlight_file('test.php', true); | |
echo $source; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ php -s test.phps > test.html | |
$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"minimum-stability": "dev", | |
"require": { | |
"silex/silex": "1.0.*", | |
"zendframework/zendframework": "2.0.*" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
backend default { | |
.host = "127.0.0.1"; | |
.port = "8080"; | |
} | |
acl purge { | |
"localhost", | |
"69.195.222.132" | |
} | |
sub vcl_recv { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once __DIR__.'/vendor/autoload.php'; | |
use Symfony\Component\HttpKernel\HttpCache\Esi; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\HttpFoundation\Response; | |
$esi = new Esi; | |
$request = Request::createFromGlobals(); | |
$response = new Response(); | |
$content = '<h1>This pages refreshes every 10 seconds</h1>'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vcl 4.0; | |
backend default { | |
.host = "127.0.0.1"; | |
.port = "8080"; | |
} | |
sub vcl_recv { | |
set req.http.Surrogate-Capability = "key=ESI/1.0"; | |
} |