PHP

Classes & objects in PHP

Në shqip: Klasat dhe objektet në PHP

ShpjegimiSQ

Në PHP krijon klasa me class dhe objekte me new. Fushat dhe metodat i arrin me shigjetën -> ($lojtari->emri), dhe brenda klasës objekti quhet $this.

EnglishEN

In PHP you create classes with class and objects with new. You reach properties and methods with the arrow -> ($player->name), and inside the class the object is called $this.

Si ta mendosh

Si kallëpi i biskotave dhe biskotat që dalin prej tij.

Lexoje në anglisht

Like a cookie cutter and the cookies it makes.

Shembull kodiphp

class Lojtar {
  public function __construct(public string $emri, public int $gola = 0) {}
  public function shenon(): void { $this->gola++; }
}
$l = new Lojtar("Arta"); $l->shenon();

Terma të lidhur