3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Form_CHK { static function textarea( &$value ) { return mb_strlen( trim( $value ) ) ? true : false; } static function radio( &$value ) { return ! empty( $value ); } static function checkbox( &$value ) { return count( $value ) ? true : false; } static function detail( &$value, $id ) { } } function tf($bool) { return $bool?'true':'false'; } $radios = array( 'job', 'sex', 'age', 'area', 'career', 'joined', 'source', 'satisfaction', ); $checkboxes = array( 'usage', 'purpose', 'attraction', 'next', ); $textareas = array( 'free_msg', ); $details = array( 'usage' => '8', 'source' => '9', 'purpose' => '9', 'next' => '11', ); ?> <div class="container-fluid"> <div class="row"> <div class="col-md-12 main"> <?php foreach( $radios as $id ) { if( isset( $_POST[ $id ] ) && tf( Form_CHK::radio( $_POST[ $id ] ) ) ) { echo $id.'は入力済みです。'.PHP_EOL; // return Form_CHK::radio( $_POST[ $id ] ); } else { echo $id.'が未入力です。'.PHP_EOL; } } foreach( $checkboxes as $id ) { if( isset( $_POST[ $id ] ) && tf( Form_CHK::checkbox( $_POST[ $id ] ) ) ) { echo $id.'は入力済みです。'.PHP_EOL; // return Form_CHK::checkbox( $_POST[ $id ] ); } else { echo $id.'が未入力です。'.PHP_EOL; } } foreach( $textareas as $id ) { if( isset( $_POST[ $id ] ) && tf( Form_CHK::textarea( $_POST[ $id ] ) ) ) { echo $id.'は入力済みです。'.PHP_EOL; // return Form_CHK::textarea( $_POST[ $id ] ); } else { echo $id.'が未入力です。'.PHP_EOL; } } var_dump($_POST['free_msg']); ?> <h1 class="page-header"><?php _e('Questionnaire', 'sp'); ?> <small>(参加者ID: <?php echo $_COOKIE[ SP__PID_COOKIE_NAME ]; ?>)</small></h1> <?php print_r( $_POST ); ?> <p class="lead">本日は、WordCamp Tokyo 2014へご参加いただきまことにありがとうございました。</p> <p>今後のWordCampの開催・運営に役立てるため、アンケートにご協力をお願いいたします。</p> </div> </div> </div>
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
<div class="container-fluid"> <div class="row"> <div class="col-md-12 main"> jobが未入力です。 sexが未入力です。 ageが未入力です。 areaが未入力です。 careerが未入力です。 joinedが未入力です。 sourceが未入力です。 satisfactionが未入力です。 usageが未入力です。 purposeが未入力です。 attractionが未入力です。 nextが未入力です。 free_msgが未入力です。 Warning: Undefined array key "free_msg" in /in/d6YJh on line 80 NULL <h1 class="page-header"> Fatal error: Uncaught Error: Call to undefined function _e() in /in/d6YJh:82 Stack trace: #0 {main} thrown in /in/d6YJh on line 82
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.31, 7.4.0 - 7.4.33
<div class="container-fluid"> <div class="row"> <div class="col-md-12 main"> jobが未入力です。 sexが未入力です。 ageが未入力です。 areaが未入力です。 careerが未入力です。 joinedが未入力です。 sourceが未入力です。 satisfactionが未入力です。 usageが未入力です。 purposeが未入力です。 attractionが未入力です。 nextが未入力です。 free_msgが未入力です。 Notice: Undefined index: free_msg in /in/d6YJh on line 80 NULL <h1 class="page-header"> Fatal error: Uncaught Error: Call to undefined function _e() in /in/d6YJh:82 Stack trace: #0 {main} thrown in /in/d6YJh on line 82
Process exited with code 255.
Output for 7.3.32 - 7.3.33
<div class="container-fluid"> <div class="row"> <div class="col-md-12 main"> jobが未入力です。 sexが未入力です。 ageが未入力です。 areaが未入力です。 careerが未入力です。 joinedが未入力です。 sourceが未入力です。 satisfactionが未入力です。 usageが未入力です。 purposeが未入力です。 attractionが未入力です。 nextが未入力です。 free_msgが未入力です。 NULL <h1 class="page-header"> Fatal error: Uncaught Error: Call to undefined function _e() in /in/d6YJh:82 Stack trace: #0 {main} thrown in /in/d6YJh on line 82
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
<div class="container-fluid"> <div class="row"> <div class="col-md-12 main"> jobが未入力です。 sexが未入力です。 ageが未入力です。 areaが未入力です。 careerが未入力です。 joinedが未入力です。 sourceが未入力です。 satisfactionが未入力です。 usageが未入力です。 purposeが未入力です。 attractionが未入力です。 nextが未入力です。 free_msgが未入力です。 Notice: Undefined index: free_msg in /in/d6YJh on line 80 NULL <h1 class="page-header"> Fatal error: Call to undefined function _e() in /in/d6YJh on line 82
Process exited with code 255.
Output for 5.0.2 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
<div class="container-fluid"> <div class="row"> <div class="col-md-12 main"> jobが未入力です。 sexが未入力です。 ageが未入力です。 areaが未入力です。 careerが未入力です。 joinedが未入力です。 sourceが未入力です。 satisfactionが未入力です。 usageが未入力です。 purposeが未入力です。 attractionが未入力です。 nextが未入力です。 free_msgが未入力です。 Notice: Undefined index: free_msg in /in/d6YJh on line 80 NULL <h1 class="page-header"> Fatal error: Call to undefined function _e() in /in/d6YJh on line 82
Process exited with code 255.
Output for 5.0.0 - 5.0.1
<div class="container-fluid"> <div class="row"> <div class="col-md-12 main"> Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/d6YJh on line 61 jobが未入力です。PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/d6YJh on line 61 sexが未入力です。PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/d6YJh on line 61 ageが未入力です。PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/d6YJh on line 61 areaが未入力です。PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/d6YJh on line 61 careerが未入力です。PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/d6YJh on line 61 joinedが未入力です。PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/d6YJh on line 61 sourceが未入力です。PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/d6YJh on line 61 satisfactionが未入力です。PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/d6YJh on line 69 usageが未入力です。PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/d6YJh on line 69 purposeが未入力です。PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/d6YJh on line 69 attractionが未入力です。PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/d6YJh on line 69 nextが未入力です。PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/d6YJh on line 77 free_msgが未入力です。PHP_EOL Notice: Undefined index: free_msg in /in/d6YJh on line 80 NULL <h1 class="page-header"> Fatal error: Call to undefined function _e() in /in/d6YJh on line 82
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/d6YJh on line 4
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
Parse error: parse error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/d6YJh on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/d6YJh on line 4
Process exited with code 255.

preferences:
247.06 ms | 401 KiB | 312 Q