3v4l.org

run code in 300+ PHP versions simultaneously
<? // Make array of URLs to work with $URLs = array( 'http://zonzoo.nl/uw-telefoons-verkopen/1023/Apple+iPhone+4+16GB', 'http://zonzoo.nl/uw-telefoons-verkopen/1024/Apple+iPhone+4+32GB', 'http://zonzoo.nl/uw-telefoons-verkopen/1272/Apple+iPhone+4+8GB' ); // Loop through each array and store the prices in arrays foreach ($URLs as $URL) { $working[] = do_shortcode('[wpwg url="' . $URL . '" selector=".price-quote.working dd" cache="0" rem_tags="script, style" newtab="false"]'); $not_working[] = do_shortcode('[wpwg url="' . $URL . '" selector=".price-quote.not_working dd" cache="0" rem_tags="script, style" newtab="false"]'); } // Open the file "zonzoo.csv" for writing $file = fopen('zonzoo.csv', 'w'); // Save the column headers fputcsv($file, array('ID', 'NAME', 'CATEGORY', 'BRAND', 'PRICE', 'DEEPLINK', 'IMAGE', 'SHIPPING')); // Sample data. This can be fetched from MySQL too $data = array ( array(1, 'iPhone 4 16GB', 'Mobiel', 'Apple', 0, 'http://zonzoo.nl/uw-telefoons-verkopen/1023/Apple+iPhone+4+16GB', 'http://www.fonebank.com/images/uploads/handsets/apple-iphone-4-ofic-final.jpg', 0), array(2, 'iPhone 4 32GB', 'Mobiel', 'Apple', 0, 'http://zonzoo.nl/uw-telefoons-verkopen/1024/Apple+iPhone+4+32GB', 'http://www.fonebank.com/images/uploads/handsets/apple-iphone-4-ofic-final.jpg', 0), array(3, 'iPhone 4 8GB', 'Mobiel', 'Apple', 0, 'http://zonzoo.nl/uw-telefoons-verkopen/1272/Apple+iPhone+4+8GB', 'http://www.fonebank.com/images/uploads/handsets/apple-iphone-4-ofic-final.jpg', 0) ); // Replace the prices of working mobile phones $i = 0; foreach ($working as $price_working) { $data[$i][4] = $price_working; $i++; } // Replace the prices of not-working mobile phones $x = 0; foreach ($not_working as $price_not_working) { $data[$x][7] = $price_not_working; $x++; } // Save each row of the data foreach ($data as $row) { fputcsv($file, $row); } // Close the file fclose($file); ?>
Output for 7.2.29 - 7.2.33, 7.3.16 - 7.3.31, 7.4.0 - 7.4.25, 7.4.27 - 7.4.32, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
<? // Make array of URLs to work with $URLs = array( 'http://zonzoo.nl/uw-telefoons-verkopen/1023/Apple+iPhone+4+16GB', 'http://zonzoo.nl/uw-telefoons-verkopen/1024/Apple+iPhone+4+32GB', 'http://zonzoo.nl/uw-telefoons-verkopen/1272/Apple+iPhone+4+8GB' ); // Loop through each array and store the prices in arrays foreach ($URLs as $URL) { $working[] = do_shortcode('[wpwg url="' . $URL . '" selector=".price-quote.working dd" cache="0" rem_tags="script, style" newtab="false"]'); $not_working[] = do_shortcode('[wpwg url="' . $URL . '" selector=".price-quote.not_working dd" cache="0" rem_tags="script, style" newtab="false"]'); } // Open the file "zonzoo.csv" for writing $file = fopen('zonzoo.csv', 'w'); // Save the column headers fputcsv($file, array('ID', 'NAME', 'CATEGORY', 'BRAND', 'PRICE', 'DEEPLINK', 'IMAGE', 'SHIPPING')); // Sample data. This can be fetched from MySQL too $data = array ( array(1, 'iPhone 4 16GB', 'Mobiel', 'Apple', 0, 'http://zonzoo.nl/uw-telefoons-verkopen/1023/Apple+iPhone+4+16GB', 'http://www.fonebank.com/images/uploads/handsets/apple-iphone-4-ofic-final.jpg', 0), array(2, 'iPhone 4 32GB', 'Mobiel', 'Apple', 0, 'http://zonzoo.nl/uw-telefoons-verkopen/1024/Apple+iPhone+4+32GB', 'http://www.fonebank.com/images/uploads/handsets/apple-iphone-4-ofic-final.jpg', 0), array(3, 'iPhone 4 8GB', 'Mobiel', 'Apple', 0, 'http://zonzoo.nl/uw-telefoons-verkopen/1272/Apple+iPhone+4+8GB', 'http://www.fonebank.com/images/uploads/handsets/apple-iphone-4-ofic-final.jpg', 0) ); // Replace the prices of working mobile phones $i = 0; foreach ($working as $price_working) { $data[$i][4] = $price_working; $i++; } // Replace the prices of not-working mobile phones $x = 0; foreach ($not_working as $price_not_working) { $data[$x][7] = $price_not_working; $x++; } // Save each row of the data foreach ($data as $row) { fputcsv($file, $row); } // Close the file fclose($file); ?>
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 <? // Make array of URLs to work with $URLs = array( 'http://zonzoo.nl/uw-telefoons-verkopen/1023/Apple+iPhone+4+16GB', 'http://zonzoo.nl/uw-telefoons-verkopen/1024/Apple+iPhone+4+32GB', 'http://zonzoo.nl/uw-telefoons-verkopen/1272/Apple+iPhone+4+8GB' ); // Loop through each array and store the prices in arrays foreach ($URLs as $URL) { $working[] = do_shortcode('[wpwg url="' . $URL . '" selector=".price-quote.working dd" cache="0" rem_tags="script, style" newtab="false"]'); $not_working[] = do_shortcode('[wpwg url="' . $URL . '" selector=".price-quote.not_working dd" cache="0" rem_tags="script, style" newtab="false"]'); } // Open the file "zonzoo.csv" for writing $file = fopen('zonzoo.csv', 'w'); // Save the column headers fputcsv($file, array('ID', 'NAME', 'CATEGORY', 'BRAND', 'PRICE', 'DEEPLINK', 'IMAGE', 'SHIPPING')); // Sample data. This can be fetched from MySQL too $data = array ( array(1, 'iPhone 4 16GB', 'Mobiel', 'Apple', 0, 'http://zonzoo.nl/uw-telefoons-verkopen/1023/Apple+iPhone+4+16GB', 'http://www.fonebank.com/images/uploads/handsets/apple-iphone-4-ofic-final.jpg', 0), array(2, 'iPhone 4 32GB', 'Mobiel', 'Apple', 0, 'http://zonzoo.nl/uw-telefoons-verkopen/1024/Apple+iPhone+4+32GB', 'http://www.fonebank.com/images/uploads/handsets/apple-iphone-4-ofic-final.jpg', 0), array(3, 'iPhone 4 8GB', 'Mobiel', 'Apple', 0, 'http://zonzoo.nl/uw-telefoons-verkopen/1272/Apple+iPhone+4+8GB', 'http://www.fonebank.com/images/uploads/handsets/apple-iphone-4-ofic-final.jpg', 0) ); // Replace the prices of working mobile phones $i = 0; foreach ($working as $price_working) { $data[$i][4] = $price_working; $i++; } // Replace the prices of not-working mobile phones $x = 0; foreach ($not_working as $price_not_working) { $data[$x][7] = $price_not_working; $x++; } // Save each row of the data foreach ($data as $row) { fputcsv($file, $row); } // Close the file fclose($file); ?>
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.6, 7.3.32 - 7.3.33, 7.4.26, 7.4.33, 8.0.13
Fatal error: Uncaught Error: Call to undefined function do_shortcode() in /in/KhPNM:12 Stack trace: #0 {main} thrown in /in/KhPNM on line 12
Process exited with code 255.

preferences:
129.98 ms | 402 KiB | 173 Q