zoukankan      html  css  js  c++  java
  • PHP编码相关函数试题

    1.检查字符串在指定的编码里是否有效的函数是什么?

    2.获取字符编码的函数是什么?

    3.解析 GET/POST/COOKIE 数据并设置全局变量的函数是什么?

    4.大小写不敏感地查找字符串在另一个字符串中首次出现的位置的两个函数是什么?

    5.大小写敏感的查找字符串在另一个字符串中首次出现的位置的两个函数是什么?

    6.获取字符串的长度的两个函数是什么?

    7.将字符串全部转换成小写的两个函数是什么?

    8.将字符串全部转换成大写的两个函数是什么?

    9.统计字符串出现的次数的两个函数是什么?

    10.获取字符串的部分的函数是什么?


    答案:

    1.bool mb_check_encoding ([ string $var = NULL [, string $encoding = mb_internal_encoding() ]] )

     //检查指定的字节流在指定的编码里是否有效。它能有效避免所谓的“无效编码攻击(Invalid Encoding Attack)”

    2.string mb_detect_encoding ( string $str [, mixed $encoding_list = mb_detect_order() [, bool$strict = false ]] )

    3.bool mb_parse_str ( string $encoded_string [, array &$result ] )

      例如:$str = 'city=shanghai&job=Phper';mb_parse_str($str);echo $city;

    4.int mb_stripos ( string $haystack , string $needle [, int $offset = 0 [, string $encoding = mb_internal_encoding() ]] )

     int stripos ( string $haystack , string $needle [, int $offset = 0 ] )

    5.int mb_strpos ( string $haystack , string $needle [, int $offset = 0 [, string $encoding = mb_internal_encoding() ]] )

       int strpos ( string $haystack , string $needle [, int $offset = 0 ] )

    6.mixed mb_strlen ( string $str [, string $encoding = mb_internal_encoding() ] )

      int strlen ( string $string )

    7.string mb_strtolower ( string $str [, string $encoding = mb_internal_encoding() ] )

      string strtolower ( string $string )

    8.string mb_strtoupper ( string $str [, string $encoding = mb_internal_encoding() ] )

      string strtoupper ( string $string )

    9.int mb_substr_count ( string $haystack , string $needle [, string $encoding = mb_internal_encoding() ] )

       int substr_count ( string $haystack , string $needle [, int $offset = 0 [, int $length ]] )

    10.string mb_substr ( string $str , int $start [, int $length = NULL [, string $encoding = mb_internal_encoding() ]] )

  • 相关阅读:
    使用IDEA模拟git命令使用的常见场景
    解决 No converter found for return value of type: class java.util.ArrayList
    Connections could not be acquired from the underlying database! ### The error may exist in mapper/BookMapper.xml
    There is no PasswordEncoder mapped for the id "null"
    The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone
    MySQL错误:2003-Can't connect to MySQL server on 'localhost'(10061 "unknown error")
    镜像源
    读书笔记 Week5 2018-4-5
    [第五周课后作业] 软件创新分析
    C#入门学习笔记
  • 原文地址:https://www.cnblogs.com/xiaozong/p/5755969.html
Copyright © 2011-2022 走看看