keti275 wrote: …I bought a new iPhone and all the photos that were in iCloud were transferred, I deleted the photos on the old phone and logged out of the account, then the photos were deleted on the new phone too. I checked iCloud and they are not in the recently deleted ones, how can I get the photos back
I'm so sorry! When you selected pictures to remove them from "Recently Deleted," you were given this warning before the final step:

It says "This will delete the selected photos from iCloud and all connected devices."
A great safety feature on the iPhone is that deleted pictures remain in the "Recently Deleted" view for 30 days before they are removed permanently. This safety feature can be defeated, though, by choosing to prematurely delete pictures from the "Recently Deleted" view. As the message warns, if you use iCloud Photos, then that "synchronizes" its Photos Library with the phone, so what you see on the phone is what is at iCloud. iCloud Photos doesn't keep pictures in "Recently Deleted" any longer than the phone does.
Unfortunately, there is no extra safety feature backing up the 1st safeties. You should back up your pictures to an external drive. See this:
iPhone backups--iPhone User Guides
Pay special attention to backing up to a computer.