Skip to content →

Category: PHP5

PHP5.3 : goto

Pernah guna fungsi goto? last time aku guna mcm 4-5 tahun dlu. sebab dulu PHP memang takde.

/* function lock */ function lock() { $file = fopen("file.txt","r+"); retry: if(flock($file,LOCK_EX)) { fwrite($file, "Success!"); fclose($file); return 0; } else goto retry; }

loop dalam function. nice?

Leave a Comment