1
0
mirror of https://github.com/jupeter/clean-code-php.git synced 2025-09-26 05:59:04 +02:00

Merge pull request #87 from peter-gribanov/preg_split

Change preg_split() to explode()
This commit is contained in:
Tomáš Votruba
2017-09-08 21:57:35 +02:00
committed by GitHub

View File

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