3v4l.org

run code in 300+ PHP versions simultaneously
<?php $content = get_the_content(); $description = array(); $j=0; if (preg_match_all('/<div id="description" class="description">([^<]*)<\/div>/', $content, $match)) { for( $i = 0; $i < count($match[0]); $i = $i+1 ) { $description[] = $match[0][$i]; } } $attachments =& get_children($args); $arrayMatches = array(); if ($attachments) { foreach(array_chunk($attachments, 2) as $img) { echo '<div class="two_cols">'; foreach($img as $attachment) { foreach($attachment as $attachment_key => $attachment_value) { $imageID = $attachment->ID; $imageTitle = $attachment->post_title; $imagearray = wp_get_attachment_image_src($attachment_value, $size, false); $imageAlt = get_post_meta($imageID, '_wp_attachment_image_alt', true); $imageURI = $imagearray[0]; // 0 is the URI $imageWidth = $imagearray[1]; // 1 is the width $imageHeight = $imagearray[2]; // 2 is the height ?> <div class="col_1_2"> <div id="attachment_<?php echo $imageID; ?>" class="wp-caption alignnone" style="width: 356px;"> <a rel="lightbox-0" href="<?php echo $imageURI; ?>"><img class="wp-image-<?php echo $imageID; ?> size-full" title="<?php echo $imageTitle; ?>" src="<?php echo $imageURI; ?>" alt="<?php echo $imageAlt; ?>" width="456" height="304" /></a> <p class="wp-caption-text"><?php echo $imageTitle; ?></p> <div class="full-description"><?php echo $match[0][$j];?></div> <?php //Array already declare $arrayMatches[] = $match[0][$j]; ?> </div> </div> <?php break; } $j++; } // I'm into a foreach (line 6) $result = array(); array_walk_recursive($arrayMatches, function($v, $k)use(&$result){ $result[] = $v; }); $$result = array_chunk($$result, 2); foreach($$result as $v) { echo "<div>" . implode(" ", $v) . "</div>"; } echo '</div>'; } }
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught Error: Call to undefined function get_the_content() in /in/bailo:3 Stack trace: #0 {main} thrown in /in/bailo on line 3
Process exited with code 255.
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Fatal error: Call to undefined function get_the_content() in /in/bailo on line 3
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/bailo on line 63
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION in /in/bailo on line 63
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/bailo on line 63
Process exited with code 255.

preferences:
231.89 ms | 401 KiB | 327 Q