I am trying to identify a blank lines in a string. Below is my attempt in PHP:

```
<?php 
$alldevs = $_POST['devs'];
$devices = explode("\n", $alldevs);

foreach($devices as $device) {
    if(!empty($device)){
        echo $device;
    } else {
        echo "end of value";
    }
}
?>

```

When I input the following:

```
1
2
3

4

```

I get this output:

```
1
2
3

4

```

But what it should be outputting is this:

```
1
2
3
end of value
end of value
4

```

What am I doing wrong?