• Resolved ak2447

    (@ak2447)


    I am using [str_replace(array(“\n”, “\r\n”), array(“<br />”, “<br />”), {column_29[1]})] however since PHP 7.3 curly braces in an array are deprecated. So even though the curly braces here aren’t technically part of the array, PHP is seeing them and erroring out.

    Is there a way to write this and escape the curly braces, while keeping the array and the column reference variable in tact?

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter ak2447

    (@ak2447)

    Actually upon further debugging it looks like the plugin needs a big update to remove all the curly braces from all array types.

    Plugin Author WP All Import

    (@wpallimport)

    Hi @ak2447,

    The curly braces aren’t a problem here, but you need to use a custom function instead of using str_replace inline, e.g.:

    function my_replace_data( $data ) {
    	return str_replace( array( "\n", "\r\n" ), array( "<br>", "<br>"), $data );
    }

    You’d use this function in the import template like this:

    [my_replace_data({column_29[1]})]

    Plugin Author WP All Import

    (@wpallimport)

    Hi @ak2447,

    I’m marking this as resolved since we haven’t heard back. Please start a new topic if you have any other questions.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘str_replace array’ is closed to new replies.