R
R
ree4i2015-10-20 16:12:57
PHP
ree4i, 2015-10-20 16:12:57

Filesize php how to compare size?

I'm parsing the site, you need to skip posts where the picture with the address is different, but with the content "no photo".
The code

@copy($filmItem->find('div[class=filmImage] a img', 0)->src, $_SERVER['DOCUMENT_ROOT'].'/uploads/temp_file_img');
if ( filesize($_SERVER['DOCUMENT_ROOT'].'/uploads/temp_file_img') != filesize($_SERVER['DOCUMENT_ROOT'].'/uploads/atal_file_img') )

atal_file_img is the same file copied earlier to the server. He is permanent. Moreover, he took up such a perversion for a reason - it also fails to compare with a number, it still skips if.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Skobkin, 2015-10-20
@skobkin

And where did you get the idea that it "skips" if?
Use a debugger to see what is returned from both filesize() calls.
Well, it’s more correct to compare numbers with strong typing:
By the way, both filesize() can return false for you (and generate a warning at a certain level of showing errors) due to an error.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question