views:

54

answers:

2

ASP has a MeasureString function that returns the width, in pixels, of a string given a certain font/size. Is this possible in PHP?

+3  A: 

Yes, using GD library.

http://www.php.net/manual/en/function.imagettfbbox.php

this is for text rendered on an image. Text width varies a bit depending on the browser, OS (font smoothing, different rendering)

Alexander
Thank you very much.
Debashis
+1  A: 

Perhaps you could use the imagettfbbox function if you have GD installed

HCL