Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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

Extension

© 2023-2026, Damien Seguy - Exakat