1
0
mirror of https://github.com/jupeter/clean-code-php.git synced 2025-09-25 21:49:04 +02:00

change preg_split() to explode()

This commit is contained in:
Peter Gribanov
2017-09-07 11:19:36 +03:00
committed by GitHub
parent 6c01399ce8
commit 0de08e1275

View File

@@ -545,7 +545,7 @@ function splitIntoFirstAndLastName()
{
global $name;
$name = preg_split('/ /', $name);
$name = explode(' ', $name);
}
splitIntoFirstAndLastName();
@@ -558,7 +558,7 @@ var_dump($name); // ['Ryan', 'McDermott'];
```php
function splitIntoFirstAndLastName($name)
{
return preg_split('/ /', $name);
return explode(' ', $name);
}
$name = 'Ryan McDermott';