Romanian (Română) translation by George Percic (you can also view the original English article)
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:
<?php $result = null; if (5>3) { $result = "Bigger"; } else { $result = "Less"; }
Folosind operatorul ternar, vom scrie exemplul de mai sus astfel:
<?php $result = 5 > 3 ? "Bigger" : "Less";
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.
Subscribe below and we’ll send you a weekly email summary of all new Code tutorials. Never miss out on learning about the next big thing.
Update me weeklyEnvato Tuts+ tutorials are translated into other languages by our community members—you can be involved too!
Translate this post