x34cha
11-06-2012, 01:04 PM
So I have tried and tried and just can't get it to work, if somebody could help.. would be great... I have a file and it has many lines, I want to take the last character of all these lines and echo them with each one being on a new line.. obviously this doesnt work and im really quite bad at php.. but it was a attempt.
<?php
$str = file_get_contents("problems.txt");
$arr = explode("*", $str);
foreach ($arr as $value) {
$last = $value[strlen($value)-1];
echo $last;
}
?>
<?php
$str = file_get_contents("problems.txt");
$arr = explode("*", $str);
foreach ($arr as $value) {
$last = $value[strlen($value)-1];
echo $last;
}
?>