Unlimited WordPress themes, graphics, videos & courses! Unlimited asset downloads! From $16.50/m
Advertisement
  1. Code
  2. PHP
Code

Operatorul ternar in PHP

by
Difficulty:IntermediateLength:QuickLanguages:

Romanian (Română) translation by George Percic (you can also view the original English article)

What You'll Be Creating

Din videoclip

Operatorul ternar ne permite sa simplificam cateva structuri conditionale in PHP. Vom vedea cum poate fi folosit in dezvoltarea ghidata de testare (test-driven development) si refactorizare pentru a simplifica codul de mai jos:

Folosind operatorul ternar, vom scrie exemplul de mai sus astfel:

Acesta este, evident, un mod mult mai simplu de a scrie structuri conditionale intr-un mod relativ usor de inteles si ar trebui luat in considerare cand vom scrie cod.

Advertisement
Advertisement
Advertisement
Advertisement
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.