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
https://forums.phpfreaks.com/topic/228681-strange-format-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.