codehaven - php snippets - coding help
Generic filters
Exact matches only
  • Fatal error: [] operator not supported for strings

    12th March 2017

    Php - Strings

    php codehaven

    You have probably defined $name, $date, $text or $date2 to be a string, like:

    Then if you treat it like an array it will give that fatal error:

    To solve your problem just add the following code at the beginning of the loop:

    This will reset their value to array and then you’ll able to use them as arrays.

    By ‘shoe’

    Was this code snippet helpful?