Asf_Util::atrim

Call PHP built-in function(trim) to filter data

Can filter strings or arrays


Description

public static mixed Asf_Util::atrim(mixed $data)

Parameters

data

Input a mixed

Return Values

The trimmed string

Examples

Example #1

<?php
$ta = array('1 ', ' 2', 'id' => ' 333 ', 'cat_id' => 4, '6' => ' 5000', ' hello ', array(' this is hello', 10000001, 0.1));
$result = Asf_Util::atrim($ta); 
var_dump($result);

The above example will output:

array(7) {
  [0]=>
  string(1) "1"
  [1]=>
  string(1) "2"
  ["id"]=>
  string(3) "333"
  ["cat_id"]=>
  int(4)
  [6]=>
  string(4) "5000"
  [7]=>
  string(5) "hello"
  [8]=>
  array(3) {
    [0]=>
    string(13) "this is hello"
    [1]=>
    int(10000001)
    [2]=>
    float(0.1)
  }
}