PHP Increment a counting variable in a text file
php
Solution
$variable_from_file = (int)file_get_contents('count.txt');
But notice that this is not thread-safe.
Problem
This seems simple but I can't figure it out. ``` file_get_contents('count.txt'); $variable_from_file++; file_put_contents('count.txt', $variable_from_file); ``` There is only one line of data in `count.txt` and it is the hits counter. Is there a way to do this?