Try successive methods until OK in PHP -


i create object using different methods in given order. goal try these methods until find 1 returns different null.

$a = method_1(); if(!$a) $a = method_2(); if(!$a) $a = method_3(); ... if(!$a) print "error"; 

until then, doing using imbricated if-else structures. there more "elegant" way program ?


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

Voice chat over bluetooth between Android & Python (pybluez) -

Integrate jquery-globalize into an ASP.NET Core MVC App -