zoukankan      html  css  js  c++  java
  • 摆脱php手册第一天

    <?php
    /*=============================================================================
    #
    # Author: jack.wu - xiaowu366@gmail.com
    #
    # QQ : 54502750
    #
    # Last modified: 2011-06-07 22:36
    #
    # Filename: 01.php
    #
    # Description: 字符串函数第一天
    #
    =============================================================================*/
    /**
     * 
     * addcslashes C风格是用反斜杠转义字符串
     * addslashes  是用反斜杠转义字符串
     *
     * stripcslashes  addcslashes反向
     * stripslashes   addslashes反向
     *
     *
     * chr  返回指定字符串 
     * ord  返回字符串的ASCII码值
     */
    
    /****************************************************
     *
     * string addcslashes ( string $str , string $charlist )
     *
     ******************************************************
     */
    echo addcslashes('sadas,fff[ ]', 'A..z'); 
    //输出 \s\a\d\a\s,\f\f\f\[ \]
    echo '<br />';
    echo addcslashes('ad123', '1..9');
    //输出 ad\1\2\3
    echo '<br />';
    
    
    
    /****************************************************
     *
     * string addslashes ( string $str )
     *
     * 返回字符串,该字符串为了数据库查询语句等的需要在
     * 某些字符前加上了反斜线.
     ******************************************************
     */
    echo addslashes("echo ti'dd");
    //输出 echo ti\'dd
    echo '<br />';
    
    
    
    
    
    
    /****************************************************
     *
     * string stripcslashes( string $str )
     *
     * 返回反转义后的字符串
     ******************************************************
     */
    
    $str = "mysql is ";
    $arr = addcslashes($str, 'a..z');
    //输出 \m\y\s\q\l \i\s
    echo $arr;
    echo '<br />';
    echo stripcslashes($arr);
    //输出 mysql is
    echo '<br />';
    
    
    /****************************************************
     *
     * string chr( int $ascii)
     *
     *  返回相对于的ascii所指定的单元字符
     ******************************************************
     */
    
    echo chr(38);
    //输出 &
    echo '<br />';
    
    /****************************************************
     *
     * int ord( int $ascii)
     *
     *  返回字符串的ASCII编码
     ******************************************************
     */
    
    echo ord('a');
    //输出 97
    echo '<br />';
    
    ?>
  • 相关阅读:
    《活着》--余华
    《麦田里的守望者》--[美]杰罗姆·大卫·塞林格
    《平凡的世界》--路遥
    彩色照片转换为黑白照片(Color image converted to black and white picture)
    《戴尔·卡耐基传记》--[美]戴尔·卡耐基
    Maven的第一个小程序
    C# RabbitMQ优先级队列实战项目演练
    控制WinForm中Tab键的跳转
    C#模板引擎NVelocity实战项目演练
    C#隐藏手机号中间四位为*
  • 原文地址:https://www.cnblogs.com/xwblog/p/2074679.html
Copyright © 2011-2022 走看看