exec() versus using backticks for system calls

If you use exec() to store output in a variable, it only returns the last line of output.

<?php
$output = exec("mycommand");

# or

$output = `mycommand`;
?>

The second example returns the entire output of the command and stores it in the $output variable.

Page Comments (Click to edit)






[Click to add or edit comments])

Please prepend comments below including a date

Design by N.Design Studio, adapted by solidGone.org (version 1.0.0)
Have a nice day.