PHP

== vs === in PHP

Në shqip: == dhe === në PHP

ShpjegimiSQ

== në PHP i konverton vlerat para krahasimit („type juggling“), gjë që sjell befasi: "abc" == 0 ishte true para PHP 8. Përdor gjithmonë === që krahason edhe tipin.

EnglishEN

== in PHP converts values before comparing (“type juggling”), which brings surprises: "abc" == 0 was true before PHP 8. Always use ===, which compares the type too.

Si ta mendosh

Si të krahasosh një mollë me një foto molle dhe të thuash „njësoj“.

Lexoje në anglisht

Like comparing an apple to a photo of an apple and saying “the same”.

Shembull kodiphp

var_dump("1" == "01");   // true
var_dump("1" === "01");  // false
var_dump(null == false); // true

Terma të lidhur