ChrisB: if mit ===

Beitrag lesen

Hi,

Sind hier die drei = sinnvoll?~~~php

$content = $_GET['content'];
if($content === "maps")

  
Sie sind zumindest nicht falsch, und eigentlich auch empfehlenswert.  
  
Da $\_GET idR. Strings enthält, besteht hier allerdings wenig Gefahr einer automatischen Typ-Umwandlung, die unerwartete Ergebnisse bringen könnte.  
  
Anders sähe das aus, wenn $content nicht unbedingt ein String sein muss:  
~~~php
var_dump(0 == "maps");  
// Ausgabe: bool(true)

MfG ChrisB

--
RGB is totally confusing - I mean, at least #C0FFEE should be brown, right?