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

Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated
array(1) {
  [0]=>
  string(0) ""
}

PHP version change

This behavior changed in 8.1

Error Messages