check if php script is already running by lock file
<p>When starting the script, check for a lock file. If it does exist, quit or skip the loop. If it doesn't exist, create the file and let it run.</p>

<p>how can i add this in my php code</p>

<p>If / Else 
if file available in directory not run function if not available create file and run function</p>

<pre><code>&lt;?php
myfunction($fun)
?&gt;
</code></pre>

<p>Thanks</p>
