tokenize() public static method

Options - clean: true/false (defaults to true and removes empty tokens and whitespace)
public static tokenize ( string $data, string $separator = ',', array $options = [] ) : array
$data string The data to tokenize
$separator string The token to split the data on.
$options array
return array
Example #1
0
 public function testTokenize()
 {
     $res = Utility::tokenize('');
     $this->assertSame([], $res);
     $res = Utility::tokenize('some');
     $this->assertSame(['some'], $res);
     $res = Utility::tokenize('some, thing');
     $this->assertSame(['some', 'thing'], $res);
     $res = Utility::tokenize(',some,,, ,, thing,');
     $this->assertSame(['some', 'thing'], array_values($res));
 }