PDA

View Full Version : strlen() and calculations


sabret00the
11-29-2004, 04:36 PM
i set up a while in a function to pull some details from the database, however as part of the defined function i've set up a variable in order to get the length of a string and then subtract '4' from total. however upton checking this it seems that the variable
$galleryavatarextention = strlen($galleryavatarinfo['bigimage'])-4; isn't being saved with or without the "-4" calculation on the end, basically it's a what am i doing wrong and am i doing this the right way type question?

Dean C
11-29-2004, 06:19 PM
I can't see anything wrong with that at all :)

What i would suggest is to put this before and see what it outputs, probably is the case that this has no value:


echo $galleryavatarinfo['bigimage'];


Also note vB has a built in function to get a file extension :) Use: file_extension. It's available to you on all pages :)

sabret00the
11-29-2004, 07:16 PM
never mind just sorted it, thanks dean, you're a star :D