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>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 28
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 28
Branch analysis from position: 7
2 jumps found. (Code = 46) Position 1 = 10, Position 2 = 19
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 24
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 19
Branch analysis from position: 28
2 jumps found. (Code = 77) Position 1 = 30, Position 2 = 52
Branch analysis from position: 30
2 jumps found. (Code = 78) Position 1 = 31, Position 2 = 52
Branch analysis from position: 31
2 jumps found. (Code = 46) Position 1 = 34, Position 2 = 43
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 48
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 51
Branch analysis from position: 51
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
Branch analysis from position: 43
Branch analysis from position: 52
2 jumps found. (Code = 77) Position 1 = 54, Position 2 = 76
Branch analysis from position: 54
2 jumps found. (Code = 78) Position 1 = 55, Position 2 = 76
Branch analysis from position: 55
2 jumps found. (Code = 46) Position 1 = 58, Position 2 = 67
Branch analysis from position: 58
2 jumps found. (Code = 43) Position 1 = 68, Position 2 = 72
Branch analysis from position: 68
1 jumps found. (Code = 42) Position 1 = 75
Branch analysis from position: 75
1 jumps found. (Code = 42) Position 1 = 54
Branch analysis from position: 54
Branch analysis from position: 72
1 jumps found. (Code = 42) Position 1 = 54
Branch analysis from position: 54
Branch analysis from position: 67
Branch analysis from position: 76
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 76
Branch analysis from position: 52
Branch analysis from position: 28
filename:       /in/d6YJh
function name:  (null)
number of ops:  99
compiled vars:  !0 = $radios, !1 = $checkboxes, !2 = $textareas, !3 = $details, !4 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   ASSIGN                                                   !0, <array>
   35     1        ASSIGN                                                   !1, <array>
   41     2        ASSIGN                                                   !2, <array>
   44     3        ASSIGN                                                   !3, <array>
   52     4        ECHO                                                     '%09%09%3Cdiv+class%3D%22container-fluid%22%3E%0A%09%09%09%3Cdiv+class%3D%22row%22%3E%0A%09%09%09%09%3Cdiv+class%3D%22col-md-12+main%22%3E%0A'
   56     5      > FE_RESET_R                                       $9      !0, ->28
          6    > > FE_FETCH_R                                               $9, !4, ->28
   57     7    >   FETCH_IS                                         ~10     '_POST'
          8        ISSET_ISEMPTY_DIM_OBJ                         0  ~11     ~10, !4
          9      > JMPZ_EX                                          ~11     ~11, ->19
         10    >   INIT_FCALL                                               'tf'
         11        INIT_STATIC_METHOD_CALL                                  'Form_CHK', 'radio'
         12        FETCH_W                      global              $12     '_POST'
         13        FETCH_DIM_W                                      $13     $12, !4
         14        SEND_REF                                                 $13
         15        DO_FCALL                                      0  $14     
         16        SEND_VAR                                                 $14
         17        DO_FCALL                                      0  $15     
         18        BOOL                                             ~11     $15
         19    > > JMPZ                                                     ~11, ->24
   58    20    >   CONCAT                                           ~16     !4, '%E3%81%AF%E5%85%A5%E5%8A%9B%E6%B8%88%E3%81%BF%E3%81%A7%E3%81%99%E3%80%82'
         21        CONCAT                                           ~17     ~16, '%0A'
         22        ECHO                                                     ~17
         23      > JMP                                                      ->27
   61    24    >   CONCAT                                           ~18     !4, '%E3%81%8C%E6%9C%AA%E5%85%A5%E5%8A%9B%E3%81%A7%E3%81%99%E3%80%82'
         25        CONCAT                                           ~19     ~18, '%0A'
         26        ECHO                                                     ~19
   56    27    > > JMP                                                      ->6
         28    >   FE_FREE                                                  $9
   64    29      > FE_RESET_R                                       $20     !1, ->52
         30    > > FE_FETCH_R                                               $20, !4, ->52
   65    31    >   FETCH_IS                                         ~21     '_POST'
         32        ISSET_ISEMPTY_DIM_OBJ                         0  ~22     ~21, !4
         33      > JMPZ_EX                                          ~22     ~22, ->43
         34    >   INIT_FCALL                                               'tf'
         35        INIT_STATIC_METHOD_CALL                                  'Form_CHK', 'checkbox'
         36        FETCH_W                      global              $23     '_POST'
         37        FETCH_DIM_W                                      $24     $23, !4
         38        SEND_REF                                                 $24
         39        DO_FCALL                                      0  $25     
         40        SEND_VAR                                                 $25
         41        DO_FCALL                                      0  $26     
         42        BOOL                                             ~22     $26
         43    > > JMPZ                                                     ~22, ->48
   66    44    >   CONCAT                                           ~27     !4, '%E3%81%AF%E5%85%A5%E5%8A%9B%E6%B8%88%E3%81%BF%E3%81%A7%E3%81%99%E3%80%82'
         45        CONCAT                                           ~28     ~27, '%0A'
         46        ECHO                                                     ~28
         47      > JMP                                                      ->51
   69    48    >   CONCAT                                           ~29     !4, '%E3%81%8C%E6%9C%AA%E5%85%A5%E5%8A%9B%E3%81%A7%E3%81%99%E3%80%82'
         49        CONCAT                                           ~30     ~29, '%0A'
         50        ECHO                                                     ~30
   64    51    > > JMP                                                      ->30
         52    >   FE_FREE                                                  $20
   72    53      > FE_RESET_R                                       $31     !2, ->76
         54    > > FE_FETCH_R                                               $31, !4, ->76
   73    55    >   FETCH_IS                                         ~32     '_POST'
         56        ISSET_ISEMPTY_DIM_OBJ                         0  ~33     ~32, !4
         57      > JMPZ_EX                                          ~33     ~33, ->67
         58    >   INIT_FCALL                                               'tf'
         59        INIT_STATIC_METHOD_CALL                                  'Form_CHK', 'textarea'
         60        FETCH_W                      global              $34     '_POST'
         61        FETCH_DIM_W                                      $35     $34, !4
         62        SEND_REF                                                 $35
         63        DO_FCALL                                      0  $36     
         64        SEND_VAR                                                 $36
         65        DO_FCALL                                      0  $37     
         66        BOOL                                             ~33     $37
         67    > > JMPZ                                                     ~33, ->72
   74    68    >   CONCAT                                           ~38     !4, '%E3%81%AF%E5%85%A5%E5%8A%9B%E6%B8%88%E3%81%BF%E3%81%A7%E3%81%99%E3%80%82'
         69        CONCAT                                           ~39     ~38, '%0A'
         70        ECHO                                                     ~39
         71      > JMP                                                      ->75
   77    72    >   CONCAT                                           ~40     !4, '%E3%81%8C%E6%9C%AA%E5%85%A5%E5%8A%9B%E3%81%A7%E3%81%99%E3%80%82'
         73        CONCAT                                           ~41     ~40, '%0A'
         74        ECHO                                                     ~41
   72    75    > > JMP                                                      ->54
         76    >   FE_FREE                                                  $31
   80    77        INIT_FCALL                                               'var_dump'
         78        FETCH_R                      global              ~42     '_POST'
         79        FETCH_DIM_R                                      ~43     ~42, 'free_msg'
         80        SEND_VAL                                                 ~43
         81        DO_ICALL                                                 
   82    82        ECHO                                                     '%09%09%09%09%09%3Ch1+class%3D%22page-header%22%3E'
         83        INIT_FCALL_BY_NAME                                       '_e'
         84        SEND_VAL_EX                                              'Questionnaire'
         85        SEND_VAL_EX                                              'sp'
         86        DO_FCALL                                      0          
         87        ECHO                                                     '+%3Csmall%3E%28%E5%8F%82%E5%8A%A0%E8%80%85ID%3A+'
         88        FETCH_CONSTANT                                   ~47     'SP__PID_COOKIE_NAME'
         89        FETCH_R                      global              ~46     '_COOKIE'
         90        FETCH_DIM_R                                      ~48     ~46, ~47
         91        ECHO                                                     ~48
         92        ECHO                                                     '%29%3C%2Fsmall%3E%3C%2Fh1%3E%0A%09%09%09%09%09'
   83    93        INIT_FCALL                                               'print_r'
         94        FETCH_R                      global              ~49     '_POST'
         95        SEND_VAL                                                 ~49
         96        DO_ICALL                                                 
   84    97        ECHO                                                     '%09%09%09%09%09%3Cp+class%3D%22lead%22%3E%E6%9C%AC%E6%97%A5%E3%81%AF%E3%80%81WordCamp+Tokyo+2014%E3%81%B8%E3%81%94%E5%8F%82%E5%8A%A0%E3%81%84%E3%81%9F%E3%81%A0%E3%81%8D%E3%81%BE%E3%81%93%E3%81%A8%E3%81%AB%E3%81%82%E3%82%8A%E3%81%8C%E3%81%A8%E3%81%86%E3%81%94%E3%81%96%E3%81%84%E3%81%BE%E3%81%97%E3%81%9F%E3%80%82%3C%2Fp%3E%0A%09%09%09%09%09%3Cp%3E%E4%BB%8A%E5%BE%8C%E3%81%AEWordCamp%E3%81%AE%E9%96%8B%E5%82%AC%E3%83%BB%E9%81%8B%E5%96%B6%E3%81%AB%E5%BD%B9%E7%AB%8B%E3%81%A6%E3%82%8B%E3%81%9F%E3%82%81%E3%80%81%E3%82%A2%E3%83%B3%E3%82%B1%E3%83%BC%E3%83%88%E3%81%AB%E3%81%94%E5%8D%94%E5%8A%9B%E3%82%92%E3%81%8A%E9%A1%98%E3%81%84%E3%81%84%E3%81%9F%E3%81%97%E3%81%BE%E3%81%99%E3%80%82%3C%2Fp%3E%0A%09%09%09%09%3C%2Fdiv%3E%0A%09%09%09%3C%2Fdiv%3E%0A%09%09%3C%2Fdiv%3E'
   88    98      > RETURN                                                   1

Function tf:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 4
Branch analysis from position: 2
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d6YJh
function name:  tf
number of ops:  7
compiled vars:  !0 = $bool
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   22     1      > JMPZ                                                     !0, ->4
          2    >   QM_ASSIGN                                        ~1      'true'
          3      > JMP                                                      ->5
          4    >   QM_ASSIGN                                        ~1      'false'
          5    > > RETURN                                                   ~1
   23     6*     > RETURN                                                   null

End of function tf

Class Form_CHK:
Function textarea:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d6YJh
function name:  textarea
number of ops:  13
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'mb_strlen'
          2        INIT_FCALL                                               'trim'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $1      
          5        SEND_VAR                                                 $1
          6        DO_ICALL                                         $2      
          7      > JMPZ                                                     $2, ->10
          8    >   QM_ASSIGN                                        ~3      <true>
          9      > JMP                                                      ->11
         10    >   QM_ASSIGN                                        ~3      <false>
         11    > > RETURN                                                   ~3
    6    12*     > RETURN                                                   null

End of function textarea

Function radio:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d6YJh
function name:  radio
number of ops:  5
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        ISSET_ISEMPTY_CV                                 ~1      !0
          2        BOOL_NOT                                         ~2      ~1
          3      > RETURN                                                   ~2
   10     4*     > RETURN                                                   null

End of function radio

Function checkbox:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d6YJh
function name:  checkbox
number of ops:  8
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        COUNT                                            ~1      !0
          2      > JMPZ                                                     ~1, ->5
          3    >   QM_ASSIGN                                        ~2      <true>
          4      > JMP                                                      ->6
          5    >   QM_ASSIGN                                        ~2      <false>
          6    > > RETURN                                                   ~2
   14     7*     > RETURN                                                   null

End of function checkbox

Function detail:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d6YJh
function name:  detail
number of ops:  3
compiled vars:  !0 = $value, !1 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   18     2      > RETURN                                                   null

End of function detail

End of class Form_CHK.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.28 ms | 1406 KiB | 24 Q