Exception Example in php

functions 2013. 10. 26. 09:39

        // try and catch example

        try{

        $tru_fal_brand_by = $html->find($finding['by_brand_name'], 0);

        $tru_fal_brand_top = $html->find($finding['top_brand_name'], 0);

        $tru_fal_brand_by_title = $html->find($finding['by_use_protitle'], 0);

        if(!isset($tru_fal_brand_by))

            throw new Exception("false_by");

        }

        catch(Exception $e)

        {

            echo 'do not have : '.$e->getMessage()."<br />";


        }