Last active
December 10, 2021 12:41
-
-
Save erowsika/f4495a7377a8de3e675e3e0b73b73615 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // store result to file | |
| $file_output = [ | |
| 'unique_jabatan' => 'INSERT_MASTER_JABATAN', | |
| 'unique_subbidang' => 'INSERT_MASTER_SUBBIDANG', | |
| 'unique_bidang' => 'INSERT_MASTER_BIDANG', | |
| 'unique_unitkerja' => 'INSERT_MASTER_UNITKERJA', | |
| ]; | |
| foreach ($result as $_key => $_item) { | |
| $f = fopen(base_path($file_output[$_key]), 'w'); | |
| foreach ($_item as $_value) { | |
| fputs($f, $_value . PHP_EOL); | |
| } | |
| // remove the last eof | |
| $stat = fstat($f); | |
| ftruncate($f, $stat['size'] - 1); | |
| fclose($f); | |
| unset($f, $stat); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment