mirror of
https://github.com/jupeter/clean-code-php.git
synced 2025-09-26 22:18:59 +02:00
Merge pull request #87 from peter-gribanov/preg_split
Change preg_split() to explode()
This commit is contained in:
@@ -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';
|
||||||
|
Reference in New Issue
Block a user