I know very little PHP and I am trying to update code that was written for PHP 5.6 to 7.4.11
From what I understand split() does not work with PHP 7.4.11
I am trying to update the following 5 snips of code where split() is used.
explode
and preg_split
but those do not seem to fix the code.$arrscreenshots = split("\|", $uploadclass->screenshots);
. ' arrid = e.id.split("_");'
. ' var id = e.split("_")[1];'
. ' var arr = e.split("_");'
. ' var myarr = rows[rows.length-1].id.split("_");'
Lines 2-5 are not PHP, they're JavaScript. (Even though they're created by PHP code, they're still being run as JavaScript by the browser.)
Line 1 can be changed to use explode()
, which doesn't take a regular expression, so you can just use the delimiter directly:
$arrscreenshots = explode("|", $uploadclass->screenshots);
Or preg_split()
which does take a regular expression, so you need to format the delimiter appropriately:
$arrscreenshots = preg_split("/\|/", $uploadclass->screenshots);