Jump to content

Strange <pre> format error


wepnop

Recommended Posts

Im creating a function for executing a system command. The idea is to show the command return. I use pre to show it, so i created a general function iPre that echos a string with that tag.

 

The problem is that this code dont work.

 

function compComando($com) {
return escapeshellcmd($com);
}

function ejecComando($com) {

$return = passthru(compComando($com));
if ($return) {
	return $return;
}
else {
		pe();
}
}

function iPre($txt) {
echo '<pre>';
echo $txt;
echo '</pre>';
}


iPre(ejecComando('dir C:'));

 

But if i call this simple code it works. Why?

 

echo '<pre>';
echo ejecComando('dir C:');
echo '</pre>';

 

Here its shown well formatted, in the other no. I suppose thats something relating passing the string to the function...?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.