ctype_graph()函數是PHP中的內置函數。給定的字符串用於檢查每個字符並顯示所有不帶空格字符的可見字符。如果可見,則返回True,否則返回False。
用法:
bool ctype_graph ( $text )
參數:ctype_graph()函數接受包含已測試字符串的單個參數$text文件。
返回值:如果$text中的每個字符都是可打印的,則返回true,否則返回false。
例子:
Input : Geeks Output : Yes Input : http//geeks.com\n Output : No Explanation : "\n" is not visible in string "http//geeks.com\n".
下麵是ctype_graph()函數的實現。
程序1: 
<?php 
// PHP program to check given string  
// produce visible output or not 
  
$string = "Geeksforgeeks"; 
  
// Check strings by using ctype_graph() 
// function. 
if ( ctype_graph ($string) ) 
    echo "$string: Visible"; 
 else 
    echo "$string: Not Visible"; 
  
?>
輸出:
Geeksforgeeks: Visible
程序2:
<?php 
// PHP program to check given string 
// produce visible output or not 
  
$string = array( 
    "@!#$%^&*()_+", 
    "peacefull mind", 
    '45600'
); 
  
// Check strings by using ctype_graph() 
// function. 
foreach ($string as $test) { 
    if (ctype_graph($test)) 
        echo "$test: Visible\n"; 
    else
        echo "$test: Not Visible\n"; 
} 
  
?>
輸出:
@!#$%^&*()_+: Visible peacefull mind: Not Visible 45600: Visible
相關文章:PHP - ctype_print()用法及代碼示例
參考:http://php.net/manual/zh/function.ctype-graph.php
相關用法
- p5.js sq()用法及代碼示例
- d3.js d3.map.has()用法及代碼示例
- PHP next()用法及代碼示例
- p5.js day()用法及代碼示例
- p5.js pow()用法及代碼示例
- CSS var()用法及代碼示例
- d3.js d3.map.set()用法及代碼示例
- PHP pow( )用法及代碼示例
- PHP pi( )用法及代碼示例
- PHP Ds\Map get()用法及代碼示例
- PHP Ds\Map put()用法及代碼示例
- p5.js str()用法及代碼示例
注:本文由純淨天空篩選整理自jit_t大神的英文原創作品 PHP | ctype_graph() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
