Jump to content

Weird conditional behavior


ogarza

Recommended Posts

Hey, been banging my head against the wall for a couple of hours now.

There is an If () in the code that is driving me crazy because it is not behaving like I expect it to..

 

foreach ( $types as $type ) {
    if ( !isset( $type->modclass ) or !isset( $type->typestr ) ) {
        debugging( 'Incorrect activity type in ' . $modname );
        continue;
    }
    $var = (string)$type->type;
    if ( $var != 'assignment&type=online' ) {

        print '<br/>' . $var . '<br/>';
        
        if ( $type->modclass == MOD_CLASS_RESOURCE ) {
            $resources[$type->type] = $type->typestr;
        } else {
            $activities[$type->type] = $type->typestr;
        }
    }
}

 

results in...

 

label

resource&type=text

resource&type=html

resource&type=file

resource&type=directory

resource&type=ims

assignment_group_start

assignment&type=upload

assignment&type=online

assignment&type=uploadsingle

assignment&type=offline

assignment_group_end

 

:wtf:

 

Notice the assignment&type=online in the output... I'm just about ready to give up as to why it is still outputting $var when it is clearly equal to the compared string?

 

Any ideas?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
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.