3v4l.org

run code in 300+ PHP versions simultaneously
<?php $formerrors = array(); $formdata = array( 'first_name' => 'Tester', 'last_name' => 'Dev', 'company' => 'BobCAD', 'email' => 'no-reply@bobcad.com', 'phone' => '555-555-5555', 'country' => 'US', 'state' => 'FL', 'is_customer' => 'Yes', 'is_sw_customer' => 'No' ); foreach ($formdata as $key => &$value) { if (!empty($_POST[$key])) { $value = $_POST[$key]; } } unset($key, $value); echo "org".PHP_EOL; print_r($formdata).PHP_EOL.PHP_EOL; // Check Phone if (preg_match('/\d+/', str_replace(array('-', '(', ')', '.', ' '), '', $formdata['phone']))) { $formerrors[] = 'Please enter a valid phone number'; $formdata['phone'] = ''; } // Check Email if (preg_match('/\A[a-z0-1\-\._]+@[a-z0-1\-\.]+\Z/i', $formdata['email'])) { $formerrors[] = 'Please enter a valid email'; $formdata['email'] = ''; } // Check first_name if(empty($formdata['first_name'])) { $formerrors[] = 'Please enter a first name'; $formdata['first_name'] = ''; } // Check last_name if(empty($formdata['last_name'])) { $formerrors[] = 'Please enter a last name'; $formdata['last_name'] = ''; } // Check company if(empty($formdata['company'])) { $formerrors[] = 'Please enter a company'; $formdata['company'] = ''; } // Check country if(empty($formdata['country'])) { $formerrors[] = 'Please enter a country'; $formdata['country'] = ''; } // Check state if(empty($formdata['state'])) { $formerrors[] = 'Please enter a state'; $formdata['state'] = ''; } echo "checked".PHP_EOL; print_r($formdata).PHP_EOL.PHP_EOL;
Output for git.master, git.master_jit, rfc.property-hooks
org Array ( [first_name] => Tester [last_name] => Dev [company] => BobCAD [email] => no-reply@bobcad.com [phone] => 555-555-5555 [country] => US [state] => FL [is_customer] => Yes [is_sw_customer] => No ) checked Array ( [first_name] => Tester [last_name] => Dev [company] => BobCAD [email] => [phone] => [country] => US [state] => FL [is_customer] => Yes [is_sw_customer] => No )

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:
62.6 ms | 402 KiB | 8 Q