1 2 3 4 5 6 7 8 9 10 11
<?php $value = 'hoge'; $result = $value == 'hoge' ? hoge() : $value == 'fuga' ? fuga() : -1; print $result; function hoge() { print 'hoge'; return 10; } function fuga() { print 'fuga'; return 20; }
1
hogefuga20