| create_function() | ใช้สร้างฟังก์ชันแบบ object |
|---|---|
| func_num_args() | ใช้นับจำนวน arguments ที่ส่งมายัง function |
| func_get_arg() | ใช้คืนค่า ค่าข้อมูล ของ argument ในลำดับที่กำหนด |
| func_get_args() | ใช้คืนค่า ค่าข้อมูล ของ argument ทั้งหมด |
| function_exits() | ใช้ตรวจสอบว่ามี ฟังก์ชันที่กำหนด หรือไม่ |
| get_defined_functions() | ใช้คืนค่า ชื่อฟังก็ชันทั้งหมด |
| import_request_variables() | ใช้นำข้อมูลที่ส่งมาแบบ GET หรือ POST หรือ COOKIE มาเก็บไว้ที่ตัวแปร |
function:create_function ( parameter, return_value );
return type:object
content:ใช้สร้างฟังก์ชันแบบ object
example:$square = create_function ( "x", "return x*x" ); echo $square ( 5 );
function:func_num_args ();
return type:int
content:ใช้นับจำนวน arguments ที่ส่งมายัง function
example:function sum() { $total = 0; $count = func_num_args(); for ( $i=0; $i<$count; $i++ ) { $total += func_get_arg( $i ); } return $total; } echo sum ( 500, 300, 400 );
function:func_get_arg ( index );
return type:mixed
content:ใช้คืนค่า ค่าข้อมูล ของ argument ในลำดับที่กำหนด
example:function sum() { $total = 0; $count = func_num_args(); for ( $i=0; $i<$count; $i++ ) { $total += func_get_arg( $i ); } return $total; } echo sum ( 500, 300, 400 );
function:func_get_args ();
return type:array
content:ใช้คืนค่า ค่าข้อมูล ของ argument ทั้งหมด
example:function sum() { $total = 0; $arr = func_get_args(); $count = count ( $arr ); for ( $i=0; $i<$count; $i++ ) { $total += $arr [ $i ]; } return $total; } echo sum ( 500, 300, 400 );
function:function_exits ( function_name );
return type:boolean
content:ใช้ตรวจสอบว่ามี ฟังก์ชันที่กำหนด หรือไม่
example:function showName ( $name ) { echo "my name is " . $name ; } if ( function_exits ( "showName" ) ) { showName ( "bamboo" ); }
function:get_defined_functions();
return type:array
content:ใช้คืนค่า ชื่อฟังก็ชันทั้งหมด
example:print_r ( get_defined_functions() );
function:import_request_variables ( types, prefix );
return type:void
content:ใช้นำข้อมูลที่ส่งมาแบบ GET หรือ POST หรือ COOKIE มาเก็บไว้ที่ตัวแปร ( ตัวแปร คือ $prefix + คีย์ของตัวแปร )
example:import_request_variables ( "P", "post_" ); echo $post_name; echo $_POST["name"];
comment:ถ้า types = G หมายถึงจะแปลงการส่งค่าที่ส่งมาแบบ GET ถ้า types = P หมายถึงจะแปลงการส่งค่าที่ส่งมาแบบ POST ถ้า types = C หมายถึงจะแปลงการส่งค่าที่ส่งมาแบบ COOKIE