Here is another way of doing it:
function removeFromFile($value) {
static $entries = array(10, 56); // elements to delete
return !in_array(rtrim($value), $entries);
}
$numbers = file("text_file.txt"); // reads each line into array element
// file() retains newlines, so don't need to add them
$output = implode('', array_filter($numbers, 'removeFromFile'));
// now write $output to the file