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() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -