title: Strange error with an object declaration and url parameter
body: <p>I meet a strange error when I'm coding my application, I would like to use a parameter in url to change the class declaration of an object in a function, I explain my point of view with code, I have product page :</p>
  
  <pre><code>/Product?Page=One
  </code></pre>
  
  <p>Then I do like that to declare an object in product.php :</p>
  
  <pre><code> public function product() {
  
     $Pagenumber = $_GET['Page']
     if(isset($Pagenumber) &amp;&amp; trim($Pagenumber) == 'One'){
     var_dump('test') // give me "test" , and that mean it's OK!
     $object = new class1() 
     }
     if(isset($Pagenumber) &amp;&amp; trim($Pagenumber) == 'Two'){
  
     $object = new class2()
  
     }
     //then in the first use of object I got an error
     ...
     }
  </code></pre>
  
  <p>The error is : </p>
  
  <pre><code>    Notice: Undefined variable: object
  </code></pre>
  
  <p>I tried a lot of possibilities but I got nothing , moreover, I got a strange thing when I do like that, it's works very fine :</p>
  
  <pre><code>         $foo = "One"; // string
           $Pagenumber = "One"; 
  
           settype($foo, "string"); // $foo vaut maintenant 5   (integer)
           settype($Pagenumber, "string");
  
           if($Pagenumber == $foo){
              $object = new class1()
          }
           $object // I can use the object with no error
  
         ...
  </code></pre>
  
  <p>and here I remark that the problem is with parameter in link only?</p>
  
  <p>Someone have a better solution to change class declaration with value of parameter URL or any better solution of issue above?</p>