0

I want to write some text from script in browser.

<?php
$out = fopen('php://stdout', 'w');
fprintf($out, "Hello!");
fclose($out);
?>

I expect "Hello!" on output, but nothing happens...Could it be bug in stdout, or I just oversighted something?

Stepo
  • 1,036
  • 1
  • 13
  • 24

2 Answers2

3

This would be true if calling php from console.

But if you are talking about web access, you should use php://output

Petr
  • 3,214
  • 18
  • 21
0

Have you tried the simple :

<?php
$out = "foobar";
echo $out;
?>

?

By default, php print on STDOUT.

Gilles Quénot
  • 173,512
  • 41
  • 224
  • 223