Ok, so I was tasked with created a gallery, using a sql table is not an option, so I am doing what I can. This is my code, wich works fine, but it generates a hidden character at the end of every imate.
<?php
$photos = file("/elements/photos.php");
for ($i = 0; $i < count($photos); $i++) {
$allimages .= $imagefile = '<img src="/elements/photos/'.$photos[$i].'">';};
?>
<?=$allimages?>
This is the code that it generates
<img src="/elements/photos/t/a_little_kitten.jpg ">
I have been unable to find what this means, I believe it means "blank space" or "new line", but I cannot find it.
This is the code I have tried, but it does not work either.
$allimages = preg_replace('/\s\s+/', ' ', $allimages)
Please help.
Below is the php file I am pulling the image names from. There is no code in this file, just text.
a_little_kitten.jpg
black_cat.jpg
basket.jpg
Try rtrim
link or trim
to remove the whitespace. As I can see that there is a whitespace at the end of your a_little_kitten.jpg
and black_cat.jpg
file.

 represents a line feed. Maybe you can use str_replace()
ex: str_replace(array("\n", "\r"), '', $photos)
before for
loop.
Firebase Cloud Functions: PubSub, "res.on is not a function"
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
someone helped on how to implement my login using different table but now i want different user in the specific table for example the stock manager has a separate page and separate page for the adminheres my code hope you understand just tell me if need to re edit for some reason
I am new to PHP, today I was trying to implement a get methodI am trying to get data based on a token that already exists but, unable to retrive data
i have here a problem that needs to output the same pattern as below