$fileCode=fopen('code.cpp','w+');
fwrite($fileCode,$code);
fclose($fileCode);
putenv('C:Program FilesCodeBlocksMinGWin');
shell_exec('cd C:xampphtdocscodeland');
shell_exec('g++ -o code.exe code.cpp');
$userOutput=shell_exec('code.exe < testInput.txt');
$outputHandle=fopen('testoutput.txt','rb');
$output=fread($outputHandle,filesize('testoutput.txt'));
fclose($outputHandle);
echo $output;
echo "<br>";
echo $userOutput;
echo "<br>";
if($output==$userOutput)echo "Accepted!!!";
In my code though $output and $userOutput are showing same string but I can not get 'Accepted' .They are showing same string but actually they are not equal. What is the problem here?