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; */
Output for git.master, git.master_jit, rfc.property-hooks

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
61.87 ms | 401 KiB | 8 Q