php - Quirky if statement -


it seems if statement, i've posted below not functioning properly. don't see problem i'm stumped. if $filetype = png if statement stops @ first statement , runs that, though it's run if $filtype = jpg

here code:

if ($filetype = "jpg") { $img_r = imagecreatefromjpeg($src); } elseif ($filetype = "gif") { $img_r = imagecreatefromgif($src);   } elseif ($filetype = "png") { $img_r = imagecreatefrompng($src);   } 

what not seeing?

if change code reads...

if ($filetype = "png") { $img_r = imagecreatefrompng($src); } elseif ($filetype = "gif") { $img_r = imagecreatefromgif($src);   } elseif ($filetype = "png") { $img_r = imagecreatefrompng($src);   } 

...and $filetype = "png" works fine.

if ($filetype = "jpg") 

this assignment, not comparison.

if ($filetype == "jpg") 

will want do.


Comments