| email() | ใช้ตรวจสอบว่าเป็นรูปแบบ email หรือไม่ |
|---|---|
| email_domain() | ใช้ตรวจสอบว่าเป็นรูปแบบ email และ email นั้นเป็นของ domain ใช่หรือไม่ |
| url() | ใช้ตรวจสอบว่าเป็นรูปแบบ url หรือไม่ |
| ip() | ใช้ตรวจสอบว่าเป็นรูปแบบ ip หรือไม่ |
| credit_card() | ใช้ตรวจสอบว่าเป็นรูปแบบ credit_card ตามประเภทที่กำหนด หรือไม่ |
| phone() | ใช้ตรวจสอบว่าเป็น หมายเลขโทรศัพท์ หรือไม่ |
| date() | ใช้ตรวจสอบว่าเป็น วันที่ หรือไม่ |
| alpha() | ใช้ตรวจสอบว่าเป็น ข้อความตัวอักษรอย่างเดียวเท่านั้น หรือไม่ ( เว้นวรรคก็ไม่ได้ ) |
| alpha_numeric() | ใช้ตรวจสอบว่าเป็น ข้อความตัวอักษรหรือตัวเลข หรือไม่ ( เว้นวรรคก็ไม่ได้ ) |
| alpha_dash() | ใช้ตรวจสอบว่าเป็น ข้อความตัวอักษร, ตัวเลข, ขีดล่าง, ขีดกลาง หรือไม่ ( เว้นวรรคก็ไม่ได้ ) |
| digit() | ใช้ตรวจสอบว่าเป็น ข้อความ ตัวเลข หรือไม่ ( เว้นวรรคก็ไม่ได้ ) |
| numeric() | ใช้ตรวจสอบว่าเป็น ข้อความ ตัวเลข, จุด หรือ ขีดกลาง หรือไม่ ( เว้นวรรคก็ไม่ได้ ) |
| decimal() | ใช้ตรวจสอบว่าเป็น ข้อความ ตัวเลข ตามรูปแบบที่กำหนด หรือไม่ |
method:email ( email );
return type:boolean
special:static
content:ใช้ตรวจสอบว่าเป็นรูปแบบ email หรือไม่
example:$my_email = "bamboolabcode@gmail.com"; if ( valid::email ( $my_email ) ) { echo "This is the email."; }
method:email_domain ( email );
return type:boolean
special:static
content:ใช้ตรวจสอบว่าเป็นรูปแบบ email และ email นั้นเป็นของ domain ใช่หรือไม่
example:$my_email = "bamboolabcode@gmail.com"; if ( valid::email_domain ( $my_email ) ) { echo "This is the email of thid domain."; }
method:url ( url );
return type:boolean
special:static
content:ใช้ตรวจสอบว่าเป็นรูปแบบ url หรือไม่
example:$my_url = "http://www.bamboolabcode.com"; if ( valid::url ( $my_url ) ) { echo "This is the url."; }
method:ip ( ip, ipv6, allow_private );
return type:boolean
special:static
content:ใช้ตรวจสอบว่าเป็นรูปแบบ ip หรือไม่
example:$my_ip = "192.168.0.1"; if ( valid::ip ( $my_ip ) ) { echo "This is the ip."; }
method:credit_card ( number, type );
return type:boolean
special:static
content:ใช้ตรวจสอบว่าเป็นรูปแบบ credit_card ตามประเภทที่กำหนด หรือไม่
example:$my_credit_card = "123456"; if ( valid::credit_card ( $my_credit_card ) ) { echo "This is the credit_card."; }
comment:ตัวแปร type ถ้าไม่กำหนด จะถือว่าเป็น credit_card ประเภทไหนก็ได้
method:phone ( phone, arr_length );
return type:boolean
special:static
content:ใช้ตรวจสอบว่าเป็น หมายเลขโทรศัพท์ หรือไม่
example:$my_phone = "086-708XXXX"; if ( valid::phone ( $my_phone ) ) { echo "This is the phone number."; }
comment:ตัวแปร arr_length ใช้กำหนดว่าจะให้เป็นกี่หลักได้บ้าง โดยค่า Default คือ array ( 7, 10, 11 )
method:date ( date );
return type:boolean
special:static
content:ใช้ตรวจสอบว่าเป็น วันที่ หรือไม่
example:$my_date = "2009-12-12"; if ( valid::date ( $my_date ) ) { echo "This is the date."; }
method:alpha ( text, utf8 );
return type:boolean
special:static
content:ใช้ตรวจสอบว่าเป็น ข้อความตัวอักษรอย่างเดียวเท่านั้น หรือไม่ ( เว้นวรรคก็ไม่ได้ )
example:$my_alpha = "programming"; if ( valid::alpha ( $my_alpha ) ) { echo "This is the alpha."; }
comment:ตัวแปร utf8 ใช้กำหนดว่าจะตรวจสอบชนิด utf8 ( true )
method:alpha_numeric ( text, utf8 );
return type:boolean
special:static
content:ใช้ตรวจสอบว่าเป็น ข้อความตัวอักษรหรือตัวเลข หรือไม่ ( เว้นวรรคก็ไม่ได้ )
example:$my_alpha_numeric = "programming 2.0"; if ( valid::alpha_numeric ( $my_alpha_numeric ) ) { echo "This is the alpha - numeric."; }
comment:ตัวแปร utf8 ใช้กำหนดว่าจะตรวจสอบชนิด utf8 ( true )
method:alpha_dash ( text, utf8 );
return type:boolean
special:static
content:ใช้ตรวจสอบว่าเป็น ข้อความตัวอักษร, ตัวเลข, ขีดล่าง, ขีดกลาง หรือไม่ ( เว้นวรรคก็ไม่ได้ )
example:$my_alpha_dash = "programming 2.0"; if ( valid::alpha_dash ( $my_alpha_dash ) ) { echo "This is the alpha - dash."; }
comment:ตัวแปร utf8 ใช้กำหนดว่าจะตรวจสอบชนิด utf8 ( true )
method:digit ( text, utf8 );
return type:boolean
special:static
content:ใช้ตรวจสอบว่าเป็น ข้อความ ตัวเลข หรือไม่ ( เว้นวรรคก็ไม่ได้ )
example:$my_digit = "12.0"; if ( valid::digit ( $my_digit ) ) { echo "This is the digit."; }
comment:ตัวแปร utf8 ใช้กำหนดว่าจะตรวจสอบชนิด utf8 ( true )
method:numeric ( text );
return type:boolean
special:static
content:ใช้ตรวจสอบว่าเป็น ข้อความ ตัวเลข, จุด หรือ ขีดกลาง หรือไม่ ( เว้นวรรคก็ไม่ได้ )
example:$my_numeric = "12.0"; if ( valid::numeric ( $my_numeric ) ) { echo "This is the numeric."; }
method:decimal ( text, pattern );
return type:boolean
special:static
content:ใช้ตรวจสอบว่าเป็น ข้อความ ตัวเลข ตามรูปแบบที่กำหนด หรือไม่
example:$my_decimal = "12.0"; if ( valid::decimal ( $my_decimal, array( 5, 2 ) ) { echo "This is the my decimal pattern."; }
comment:ตัวแปร pattern ใช้กำหนดตัวแปร array โดย key ที่ 0 จะหมายถึงจำนวนตัวเลขหน้าจุดทศนิยม และ key ที่ 1 จะหมายถึงจำนวนตัวเลขหลังจุดทศนิยม