Jump to content

Can anyone solve this error: Deprecated: Function split() is deprecated


Recommended Posts

Would anyone have the answer to solve this error message?


Deprecated: Function split() is deprecated in /includes/modules/shipping/table.php on line 57


Here is the code. Line 57 is in Bold. Preg_split is suppose to work. Tried preg_explode but that didn't work. Appreciate any help!


    $table_cost = preg_split("/[:,]/" , MODULE_SHIPPING_TABLE_COST);

      $size = sizeof($table_cost);

      for ($i=0, $n=$size; $i<$n; $i+=2) {

        if ($order_total <= $table_cost[$i]) {

          $shipping = $table_cost[$i+1];




Link to comment
Share on other sites

Split() is deprecated, which doesn't mean it's unavailable.  It means it's officially not recommended to use it, and sometime in the future it will be removed entirely from the language.


Split accepted a regular expression, which preg_split accepts.  What are you trying to do?  The first line of your code segment should split the constant MODULE_SHIPPING_TABLE_COST on a comma or colon.  If you need to split only on a single character or non-variant string, explode() is orders of magnitude faster.

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.