• Marketing1on1

    (@marketing1on1com)


    Wondering if anybody could help me with this.
    Getting a notice for the following code:

    Notice: Trying to access array offset on value of type int

    Code is the following:
    if ($important = $name[0] == '!') {
    How can I re-write the code to get rid of the notice?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    You need to determine why $name is assigned an integer value and not an array. == '!' indicates we’re expecting a string value in an array element, not an integer, so there are 2 different issues with assigning values to $name.

    While you could rewrite the conditional to check for a singleton integer value instead, it likely wouldn’t match the intention of having it there in the first place.

Viewing 1 replies (of 1 total)
  • The topic ‘Notice: Trying to access array offset on value of type int wordpress’ is closed to new replies.