php - Why doesn't "exec" perform a command until I print its output? -
i onubuntu 14.04, php 5.5.9. there, have simple file a.php
:
<?php $a = exec('clear'); print($a);
if run script get:
$ php a.php <screen cleared> # nothing displayed in screen # "clear" performed
however, if comment print($a)
have file this:
<?php $a = exec('clear');
then nothing happens:
$ php a.php $ # nothing happened, see previous line above
to understanding, call variable $a
makes clear
performed. doesn't make sense, since exec() docs says:
exec — execute external program
is there reason why clear
doesn't performed until print()
called?
note related question clear cmd-shell php asking here why happens.
actually, clear gets executed when calling exec. don't see action on screen until output it.
Comments
Post a Comment