Cannot Explode() Null

Null used to be a valid argument for explode(), used as an empty string. Nowadays, PHP requires an actual string to explode.

PHP code

<?php

var_dump(explode(';', null));

?>

Before

array(1) {
  [0]=>
  string(0) ""
}

After

PHP Deprecated:  explode(): Passing null to parameter #2 ($string) of type string is deprecated in /codes/explodeWithNull.php on line 3

Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /codes/explodeWithNull.php on line 3
array(1) {
  [0]=>
  string(0) ""
}

PHP version change

This behavior changed in 8.1