Skip to content

Instantly share code, notes, and snippets.

@ik5
Created October 24, 2021 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ik5/f833b26852c6b6283391c545d5a006dd to your computer and use it in GitHub Desktop.
Save ik5/f833b26852c6b6283391c545d5a006dd to your computer and use it in GitHub Desktop.
PECL inotify example for close_write on watch directory
<?php
$fd = inotify_init();
$watch_descriptor = inotify_add_watch($fd, './watch', IN_CLOSE_WRITE);
while (true) {
$events = inotify_read($fd);
foreach ($events as $event) {
print_r($event);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment