3v4l.org

run code in 300+ PHP versions simultaneously
<?php $programs = json_decode($fields['programs']->rawvalue); $class = $fields['programs']->params->get('render_class'); ?> <div class="programs"> <?php foreach($programs as $program) { ?> <div class="program <?php echo $class; ?>"> <?php if(!empty($program->Image)) { ?> <div class="program__image"><?php echo $program->Image; ?></div> <?php } ?> <?php if(!empty($program->Title)) { ?> <h3 class="program__title"><?php echo $program->Title; ?></h3> <?php } ?> <?php if(!empty($program->Synopsis)) { echo $program->Synopsis; } ?> <div class="program__meta"> <ul> <?php if (!empty($program->Duration)) { ?> <li> <strong><?php echo JText::_('MRWC_PROGRAM_DURATION_TITLE'); ?></strong> <?php echo $program->Duration; ?> </li> <?php } ?> <?php if(!empty($program->Size)) { ?> <li> <strong><?php echo JText::_('MRWC_PROGRAM_CLASS_SIZE_TITLE'); ?></strong> <?php echo $program->Size; ?> </li> <?php } ?> <?php if(!empty($program->Duration) || !empty($program->Size)) { // you may wish to check for a non-empty Title too $mailToQuery = http_build_query(['subject' => 'Booking for ' . $program->Title . ' Program']); ?> <li> <a href="mailto:education@name.com?<?php echo $mailToQuery; ?>"> <?php echo JText::_('MRWC_PROGRAM_BOOK_LABEL'); ?> </a> </li> <?php } ?> </ul> </div> </div> <?php } ?> </div>
Output for 8.3.0 - 8.3.4, 8.3.6
Warning: Undefined variable $fields in /in/JgYpH on line 2 Warning: Trying to access array offset on null in /in/JgYpH on line 2 Warning: Attempt to read property "rawvalue" on null in /in/JgYpH on line 2 Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in /in/JgYpH on line 2 Warning: Undefined variable $fields in /in/JgYpH on line 3 Warning: Trying to access array offset on null in /in/JgYpH on line 3 Warning: Attempt to read property "params" on null in /in/JgYpH on line 3 Fatal error: Uncaught Error: Call to a member function get() on null in /in/JgYpH:3 Stack trace: #0 {main} thrown in /in/JgYpH on line 3
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Warning: Undefined variable $fields in /in/JgYpH on line 2 Warning: Trying to access array offset on null in /in/JgYpH on line 2 Warning: Attempt to read property "rawvalue" on null in /in/JgYpH on line 2 Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in /in/JgYpH on line 2 Warning: Undefined variable $fields in /in/JgYpH on line 3 Warning: Trying to access array offset on null in /in/JgYpH on line 3 Warning: Attempt to read property "params" on null in /in/JgYpH on line 3 Fatal error: Uncaught Error: Call to a member function get() on null in /in/JgYpH:3 Stack trace: #0 {main} thrown in /in/JgYpH on line 3
Process exited with code 255.
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
Warning: Undefined variable $fields in /in/JgYpH on line 2 Warning: Trying to access array offset on value of type null in /in/JgYpH on line 2 Warning: Attempt to read property "rawvalue" on null in /in/JgYpH on line 2 Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in /in/JgYpH on line 2 Warning: Undefined variable $fields in /in/JgYpH on line 3 Warning: Trying to access array offset on value of type null in /in/JgYpH on line 3 Warning: Attempt to read property "params" on null in /in/JgYpH on line 3 Fatal error: Uncaught Error: Call to a member function get() on null in /in/JgYpH:3 Stack trace: #0 {main} thrown in /in/JgYpH on line 3
Process exited with code 255.
Output for 8.0.0 - 8.0.30
Warning: Undefined variable $fields in /in/JgYpH on line 2 Warning: Trying to access array offset on value of type null in /in/JgYpH on line 2 Warning: Attempt to read property "rawvalue" on null in /in/JgYpH on line 2 Warning: Undefined variable $fields in /in/JgYpH on line 3 Warning: Trying to access array offset on value of type null in /in/JgYpH on line 3 Warning: Attempt to read property "params" on null in /in/JgYpH on line 3 Fatal error: Uncaught Error: Call to a member function get() on null in /in/JgYpH:3 Stack trace: #0 {main} thrown in /in/JgYpH on line 3
Process exited with code 255.
Output for 7.4.0 - 7.4.25, 7.4.27 - 7.4.33
Notice: Undefined variable: fields in /in/JgYpH on line 2 Notice: Trying to access array offset on value of type null in /in/JgYpH on line 2 Notice: Trying to get property 'rawvalue' of non-object in /in/JgYpH on line 2 Notice: Undefined variable: fields in /in/JgYpH on line 3 Notice: Trying to access array offset on value of type null in /in/JgYpH on line 3 Notice: Trying to get property 'params' of non-object in /in/JgYpH on line 3 Fatal error: Uncaught Error: Call to a member function get() on null in /in/JgYpH:3 Stack trace: #0 {main} thrown in /in/JgYpH on line 3
Process exited with code 255.
Output for 7.3.32, 7.4.26
Fatal error: Uncaught Error: Call to a member function get() on null in /in/JgYpH:3 Stack trace: #0 {main} thrown in /in/JgYpH on line 3
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.3.33
Notice: Undefined variable: fields in /in/JgYpH on line 2 Notice: Trying to get property 'rawvalue' of non-object in /in/JgYpH on line 2 Notice: Undefined variable: fields in /in/JgYpH on line 3 Notice: Trying to get property 'params' of non-object in /in/JgYpH on line 3 Fatal error: Uncaught Error: Call to a member function get() on null in /in/JgYpH:3 Stack trace: #0 {main} thrown in /in/JgYpH on line 3
Process exited with code 255.

preferences:
125.67 ms | 402 KiB | 182 Q