1

Is there any possible way to make this simple script function properly?

<?php
$hi = "echo hi";
shell_exec($hi);
echo "<pre>$output</pre>";
?>

please help me out?

2
  • shouldn't shell_exec($hi); read $output = shell_exec($hi);? Commented Oct 17, 2011 at 23:15
  • thx, i must have accidentally deleted something, thats what i had originally Commented Oct 17, 2011 at 23:36

2 Answers 2

3

Sure just assign the variable.

<?php
$hi = "echo hi";
$output = shell_exec($hi);
echo "<pre>$output</pre>";
?>
Sign up to request clarification or add additional context in comments.

Comments

1
$hi = "echo hi";
# the result needs to be assigned to $output before using it
$output = shell_exec($hi);
echo "<pre>$output</pre>";

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.