Hello, im going to take the final test on php tomorrow and im looking through the exercises I got but I have some problem with one.
It says I should create a loop to display a text in reverse and thats kinda easy but I now have to check if its the same as the original text, (for example: anna is anna reversed)
So I a loop but I cant figure out how to use all the letters in the loop as one variable.
This will display the name reversed:
But what can I use the collect all the letters from $check2 as one thing?PHP Code:$namn = 'anna';
for($numb = strlen($namn);$numb>=0;$numb--){
$check2 = substr($namn,$numb,1);
echo $check2;
}
![]()



Reply With Quote

Bookmarks