Array Functions

1.is_array

  • is_array ( mixed $var ) : bool
  • Finds whether a variable is an array

2.explode

  • explode ( string $delimiter , string $string [, int $limit = PHP_INT_MAX ] ) : array
  • Returns an array of strings, each of which is a substring of string formed by splitting it on boundaries formed by the string delimiter.

3.implode

  • implode ( string $glue , array $pieces ) : string
    implode ( array $pieces ) : string
  • Join array elements with a glue string.

4.split

  • This function was DEPRECATED in PHP 5.3.0, and REMOVED in PHP 7.0.0.
  • Alternatives to this function include:
    ①preg_split()
    ②explode()
    ③str_split()

5.preg_split

  • preg_split ( string $pattern , string $subject [, int $limit = -1 [, int $flags = 0 ]] ) : array
  • Split the given string by a regular expression.
  • limit
    If specified, then only substrings up to limit are returned with the rest of the string being placed in the last substring. A limit of -1 or 0 means “no limit” and, as is standard across PHP, you can use NULL to skip to the flags parameter.
  • flags
    flags can be any combination of the following flags (combined with the | bitwise operator):
    PREG_SPLIT_NO_EMPTY
    If this flag is set, only non-empty pieces will be returned by preg_split().
    PREG_SPLIT_DELIM_CAPTURE
    If this flag is set, parenthesized expression in the delimiter pattern will be captured and returned as well.
    PREG_SPLIT_OFFSET_CAPTURE
    If this flag is set, for every occurring match the appendant string offset will also be returned. Note that this changes the return value in an array where every element is an array consisting of the matched string at offset 0 and its string offset into subject at offset 1.

6.unset

  • unset ( mixed $var [, mixed $… ] ) : void
  • unset() destroys the specified variables.
  • The behavior of unset() inside of a function can vary depending on what type of variable you are attempting to destroy.

7.array_change_key_case

  • array_change_key_case ( array $array [, int $case = CASE_LOWER ] ) : array
  • Returns an array with all keys from array lowercased or uppercased. Numbered indices are left as is.
  • case
    Either CASE_UPPER or CASE_LOWER (default)

8.array_chunk

  • array_chunk ( array $array , int $size [, bool $preserve_keys = FALSE ] ) : array
  • Chunks an array into arrays with size elements. The last chunk may contain less than size elements.
  • preserve_keys
    When set to TRUE keys will be preserved. Default is FALSE which will reindex the chunk numerically
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值