3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* jobTitle.php Ideally, the model layer is used to access database data More directly generate the desired result array to be returned with loadColumn(): public function getOptions() { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('jobtitle')->from('#__jobs'); return $db->setQuery($query)->loadColumn(); } Ideally, collecting submitted data should be done in the controller layer. Ideally, generating html markup should be done in the view layer. --- technologies.php Use loadResult(): $backend = $db->setQuery($query)->loadResult(); The foreach body can be simplified: foreach ($backend as $line) { $result[] = [$line, in_array($line, $currentBackend)]; } You don't need to increment your own counter. Employ D.R.Y. coding regarding the if block. sprintf() spares interpolation/concatenation. Again, I would rather this mark up be generated in the view layer. $html = '<fieldset id="jform_technologies" class="list checkboxes">'; foreach ($this->getOptions() as $i => [$line, $checked]) { $html .= sprintf( '<label for="%1$s" class="checkbox"> <input type="checkbox" id="%1$s" name="jform[technologies][]" value="%2$s"%3$s>%2$s </label>', 'jform_backend' . $i, $line, $checked ? ' checked' : '' ); } $html .= '</fieldset>'; return $html; */
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hIUlA
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   51     0  E > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.59 ms | 1396 KiB | 13 Q