Tuesday, July 3, 2012

PHP Tips and Tricks

Remove leading zero '0030' => '30' :

$var = '0030';
$num =  (int)$var;

Execute external program : source

Exec($runCommand)->StdOut->ReadAll;
echo "

$output

"; ?>
Other script for executing external program link1 link2

Get basepath : source

 /dev/null &`;
  }
  else //windowz
  {
    $WshShell = new COM("WScript.Shell");
    $oExec = $WshShell->Run($runCommand, 7, false);
  }
?>

No comments: