there is in the table

ENUM '0','1',...,'30' 

Each number has its own name. Is there a more compact conclusion than

 if ($a->b==0) $b = 'название0'; 

etc. somehow it looks pathetic.

    1 answer 1

    Usually arrays are used for this.

     $data = [ 0 => 'name0', 1 => 'name1', ........ 30 => 'name30' ]; $b = $data[$a->b]; 

    Or a classifier table is created in the database.

     Names id | name ----------- 0 | 'name0' 1 | 'name1' ........ 30 | 'name30' 

    And all the samples are made with the join of this table.