If you are creating an application that will be run in the terminal on a Linux machine and you don’t want it to run if its already running you can use the same code below to achieve this. class pid { protected $filename; public $already_running = false; function __construct($directory) { $this->filename = $directory . ‘/’ . basename($_SERVER[‘PHP_SELF’]) . ‘.pid’;…
Tag: code
Some Simple PHP code..
Below i am going to list some simple PHP code that makes up most of a PHP coded page. If..Elseif…Else… statments $something = “Cat”; if ($something==”Cat”) { print “Cat\n”; } elseif ($something==”Dog”) { print “Dog\n”; } else { print “Dont know\n”; Explode…foreach $ex = “cat:dog:mouse:goose”; $explode = explode(“:”, $ex); foreach ($explode as $exploded) { print…