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:
@@ -545,7 +545,7 @@ function splitIntoFirstAndLastName()
|
|||||||
{
|
{
|
||||||
global $name;
|
global $name;
|
||||||
|
|
||||||
$name = preg_split('/ /', $name);
|
$name = explode(' ', $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
splitIntoFirstAndLastName();
|
splitIntoFirstAndLastName();
|
||||||
@@ -558,7 +558,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