I just want to count how many images in a folder

Can anyone give me such .asp, php or any script, which can count no. of image
in a folder, so that i can call that value to flash

For now, i m doing this with the text file, but i manually have to enter a
value for no. of images in that text file. Instead of that, I want that my
script should count no. images in that folder

Plz, help me in this...............