jeudi 27 août 2015

Why is this always evaluating to false?

I have a piece of code I made

abstract class WorkTypes
{
    const Portfolio = 0;
    const Study = 1;
}

function get_our_work ( $atts )
{

   // see http://ift.tt/1u7MYRt

    $work_type = (strcmp($atts['workType'],'ports') === 0) ?  WorkTypes::Portfolio : WorkTypes::Study;

    include "page-content/our_work.php";
}

and for reason $work_type is always evaluating to be WorkTypes::Study even when I'm 100% sure that $atts['workType'] is equal to 'ports'. So I know that (strcmp($atts['workType'],'ports') === 0) is always evaluating to false. Why?

Aucun commentaire:

Enregistrer un commentaire