码迷,mamicode.com
首页 > Web开发 > 详细

php常用函数之Math、GD篇

时间:2014-10-10 02:23:25      阅读:202      评论:0      收藏:0      [点我收藏+]

标签:des   style   color   io   os   使用   ar   for   sp   

float abs(float);

用途:求绝对值

>>例子$abs = abs( -4.5 );  => 输出 : 4.5;

 

float round(float,int n);

用途:对浮点数四舍五入n

>>例子echo round( 1.955555,2 ); => 输出 : 1.96;

 

int ceil(float);

用途:进一法取整

>>例子echo ceil( 9.001 ); => 输出 : 10;

 

float floor(float);

用途:舍去法取整

>>例子: echo floor(9.001); => 输出 : 9;

 

float fmod(float bigger,float little);

用途:浮点数取余,结果是浮点数;若前者小于后者,则为0

>>例子echo fmod( 5.7,1.3 ); => 输出 : 0.5;

 

float pow(float,int n);

用途:n次幂[次方]

>>例子echo pow( 2,3 ); => 输出 : 8;

 

float sqrt(float);

用途:求平方根

>>例子echo sqrt( 9 ); => 输出 : 3;

 

float max(float ... );

用途:求多个数字或数组的最大值;

>>例子echo max(1, 3, 5, 6, 7);  => 输出 : 7;

        echo max(array(2, 4, 5)); => 输出 : 5;

 

float min(float ... );

用途:求多个数字或数组的最小值;

>>例子echo max(1, 3, 5, 6, 7);  => 输出 : 1;

        echo max(array(2, 4, 5)); => 输出 : 2;

 

mt_rand(int,int);

用途:生成更好的随机数,推荐使用!

>>例子echo mt_rand( 0,9 ); => 输出 : 6; or other...

 

rand(int,int);

用途:生成随机数,不建议使用!

>>例子echo rand( 0,9 ); => 输出 : 1; or other...

 

pi();

用途:获取圆周率;

>>例子echo pi(); => 输出 : 3.1415926535898

 

 

-----------------------------------------我是华丽的分割线---------------------------------------

 

 

GetImageSize

作用:取得图片的大小[即长与宽]

用法array GetImageSize(string filename, array [imageinfo]);

 

Imagecreatetruecolor

作用:创建真彩图

用法resource imagecreatetruecolor ( int $width  , int $height  )

 

ImageArc

作用:画弧线

用法int ImageArc(int im, int cx, int cy, int w, int h, int s, int e, int col);

 

ImageChar

作用:写出横向字符

用法int ImageChar(int im, int font, int x, int y, string c, int col);

 

ImageCharUp

作用:写出竖式字符

用法int ImageCharup(int im, int font, int x, int y, string c, int col);

 

ImageColorAllocate

作用:匹配颜色

用法int ImageColorAllocate(int im, int red, int green, int blue);

 

ImageColorTransparent

作用:指定透明背景色

用法int ImageColorTransparent(int im, int [col]);

 

ImageCopyResized

作用:复制新图并调整大小

用法int ImageCopyResized(int dst_im, int src_im, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH);

 

ImageCreate

作用:建立新图

用法int ImageCreate(int x_size, int y_size);

 

ImageDashedLine

作用:绘虚线

用法int ImageDashedLine(int im, int x1, int y1, int x2, int y2, int col);

 

ImageDestroy

作用:结束图形

用法int ImageDestroy(int im);

 

ImageFill

作用:图形着色

用法int ImageFill(int im, int x, int y, int col);

 

ImageFilledPolygon

作用:多边形区域着色

用法int ImageFilledPolygon(int im, array points, int num_points, int col);

 

ImageFilledRectangle

作用:矩形区域着色

用法int ImageFilledRectangle(int im, int x1, int y1, int x2, int y2, int col);

 

ImageFillToBorder

作用:指定颜色区域内着色

用法int ImageFillToBorder(int im, int x, int y, int border, int col);

 

ImageFontHeight

作用:取得字型的高度

用法int ImageFontHeight(int font);

 

ImageFontWidth

作用:取得字型的宽度

用法int ImageFontWidth(int font);

 

ImageInterlace

作用:使用交错式显示与否

用法int ImageInterlace(int im, int [interlace]);

 

ImageLine

作用:绘实线

用法int ImageLine(int im, int x1, int y1, int x2, int y2, int col);

 

ImageLoadFont

作用:载入点阵字型

用法int ImageLoadFont(string file);

 

ImagePolygon

作用:绘多边形

用法int ImagePolygon(int im, array points, int num_points, int col);

 

ImageRectangle

作用:绘矩形

用法int ImageRectangle(int im, int x1, int y1, int x2, int y2, int col);

 

ImageSetPixel

作用:绘点

用法int ImageSetPixel(int im, int x, int y, int col);

 

ImageString

作用:绘横式字符串

用法int ImageString(int im, int font, int x, int y, string s, int col);

 

ImageStringUp

作用:绘直式字符串

用法int ImageStringUp(int im, int font, int x, int y, string s, int col);

 

ImageSX

作用:取得图片的宽度

用法int ImageSX(int im);

 

ImageSY

作用:取得图片的高度

用法 int ImageSY(int im);

 

ImageTTFBBox

作用:计算 TTF 文字所占区域

用法array ImageTTFBBox(int size, int angle, string fontfile, string text);

 

ImageTTFText

作用:写 TTF 文字到图中

用法array ImageTTFText(int im, int size, int angle, int x, int y, int col, string fontfile, string text);

 

ImageColorAt

作用:取得图中指定点颜色的索引值

用法int ImageColorAt(int im, int x, int y);

 

ImageColorClosest

作用:计算色表中与指定颜色最接近者

用法int ImageColorClosest(int im, int red, int green, int blue);

 

ImageColorExact

作用:计算色表上指定颜色索引值

用法int ImageColorExact(int im, int red, int green, int blue);

 

ImageColorResolve

作用:计算色表上指定或最接近颜色的索引值

用法int ImageColorResolve(int im, int red, int green, int blue);

 

ImageColorSet

作用:设定色表上指定索引的颜色

用法boolean ImageColorSet(int im, int index, int red, int green, int blue);

 

ImageColorsForIndex

作用:取得色表上指定索引的颜色

用法array ImageColorsForIndex(int im, int index);

 

ImageColorsTotal

作用:计算图的颜色数

用法int ImageColorsTotal(int im);

 

ImagePSLoadFont

作用:载入 PostScript 字型

用法int ImagePSLoadFont(string filename);

 

ImagePSFreeFont

作用:卸下 PostScript 字型

用法void ImagePSFreeFont(int fontindex);

 

ImagePSEncodeFont

作用PostScript 字型转成向量字

用法int ImagePSEncodeFont(string encodingfile);

 

ImagePSText

作用:写 PostScript 文字到图中

用法array ImagePSText(int image, string text, int font, int size, int foreground, int background, int x, int y, int space, int tightness, float angle, int antialias_steps);

 

ImagePSBBox

作用:计算 PostScript 文字所占区域

用法: array ImagePSBBox(string text, int font, int size, int space, int width, float angle);

 

ImageCreateFromPNG

作用:取出 PNG 图型

用法int ImageCreateFromPng(string filename);

 

ImagePNG

作用:建立 PNG 图型

用法int ImagePng(int im, string [filename]);

 

ImageCreateFromGIF

作用:取出 GIF 图型

用法int ImageCreateFromGif(string filename);

 

ImageGIF

作用:建立 GIF 图型

用法int ImageGif(int im, string [filename]);

 

 

php常用函数之Math、GD篇

标签:des   style   color   io   os   使用   ar   for   sp   

原文地址:http://www.cnblogs.com/phpchromer2014/p/php_func_math_gd.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!