3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Implements hook_menu */ function myownform_menu() { $items = array(); $items['myownform'] = array( 'title' => 'My Own Form', 'type' => MENU_NORMAL_ITEM, 'access arguments' => array('submit myownform'), 'page callback' => 'drupal_get_form', 'page arguments' => array('myownform_form'), ); return $items; } /** * Implements hook_form */ function myownform_form($form, &$form_state) { $form['myowntext'] = array( '#type' => 'textfield', '#title' => t('My own Text'), '#size' => 50, '#maxlength' => 50, '#required' => TRUE, '#description' => t('Please enter a small text'), ); $form['submit'] = array( '#type' => 'submit', '#value' => t('Submit') ); return $form; } /** * Validation handler for the myownform_form */ function myownform_form_validate($form, &$form_state) { if (!isset($form_state['values']['myowntext'])) { form_set_error('myowntext', t('You must enter a value.')); return FALSE; } return TRUE; } /** * Submission handler for the myownform_form */ function myownform_form_submit($form, &$form_state) { $form_state['rebuild'] = TRUE; print($_POST['myowntext']); } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bu6rV
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   51     0  E > > RETURN                                                   1

Function myownform_menu:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bu6rV
function name:  myownform_menu
number of ops:  11
compiled vars:  !0 = $items
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ASSIGN                                                   !0, <array>
    8     1        INIT_ARRAY                                       ~3      'My+Own+Form', 'title'
    9     2        FETCH_CONSTANT                                   ~4      'MENU_NORMAL_ITEM'
          3        ADD_ARRAY_ELEMENT                                ~3      ~4, 'type'
    8     4        ADD_ARRAY_ELEMENT                                ~3      <array>, 'access+arguments'
   11     5        ADD_ARRAY_ELEMENT                                ~3      'drupal_get_form', 'page+callback'
    8     6        ADD_ARRAY_ELEMENT                                ~3      <array>, 'page+arguments'
    7     7        ASSIGN_DIM                                               !0, 'myownform'
    8     8        OP_DATA                                                  ~3
   14     9      > RETURN                                                   !0
   15    10*     > RETURN                                                   null

End of function myownform_menu

Function myownform_form:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bu6rV
function name:  myownform_form
number of ops:  25
compiled vars:  !0 = $form, !1 = $form_state
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   21     2        INIT_ARRAY                                       ~3      'textfield', '%23type'
   22     3        INIT_FCALL_BY_NAME                                       't'
          4        SEND_VAL_EX                                              'My+own+Text'
          5        DO_FCALL                                      0  $4      
          6        ADD_ARRAY_ELEMENT                                ~3      $4, '%23title'
   23     7        ADD_ARRAY_ELEMENT                                ~3      50, '%23size'
   24     8        ADD_ARRAY_ELEMENT                                ~3      50, '%23maxlength'
   21     9        ADD_ARRAY_ELEMENT                                ~3      <true>, '%23required'
   26    10        INIT_FCALL_BY_NAME                                       't'
         11        SEND_VAL_EX                                              'Please+enter+a+small+text'
         12        DO_FCALL                                      0  $5      
         13        ADD_ARRAY_ELEMENT                                ~3      $5, '%23description'
   20    14        ASSIGN_DIM                                               !0, 'myowntext'
   26    15        OP_DATA                                                  ~3
   29    16        INIT_ARRAY                                       ~7      'submit', '%23type'
   30    17        INIT_FCALL_BY_NAME                                       't'
         18        SEND_VAL_EX                                              'Submit'
         19        DO_FCALL                                      0  $8      
         20        ADD_ARRAY_ELEMENT                                ~7      $8, '%23value'
   28    21        ASSIGN_DIM                                               !0, 'submit'
   30    22        OP_DATA                                                  ~7
   32    23      > RETURN                                                   !0
   33    24*     > RETURN                                                   null

End of function myownform_form

Function myownform_form_validate:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 14
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bu6rV
function name:  myownform_form_validate
number of ops:  16
compiled vars:  !0 = $form, !1 = $form_state
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   38     2        FETCH_DIM_IS                                     ~2      !1, 'values'
          3        ISSET_ISEMPTY_DIM_OBJ                         0  ~3      ~2, 'myowntext'
          4        BOOL_NOT                                         ~4      ~3
          5      > JMPZ                                                     ~4, ->14
   39     6    >   INIT_FCALL_BY_NAME                                       'form_set_error'
          7        SEND_VAL_EX                                              'myowntext'
          8        INIT_FCALL_BY_NAME                                       't'
          9        SEND_VAL_EX                                              'You+must+enter+a+value.'
         10        DO_FCALL                                      0  $5      
         11        SEND_VAR_NO_REF_EX                                       $5
         12        DO_FCALL                                      0          
   40    13      > RETURN                                                   <false>
   42    14    > > RETURN                                                   <true>
   43    15*     > RETURN                                                   null

End of function myownform_form_validate

Function myownform_form_submit:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bu6rV
function name:  myownform_form_submit
number of ops:  8
compiled vars:  !0 = $form, !1 = $form_state
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   47     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   48     2        ASSIGN_DIM                                               !1, 'rebuild'
          3        OP_DATA                                                  <true>
   49     4        FETCH_R                      global              ~3      '_POST'
          5        FETCH_DIM_R                                      ~4      ~3, 'myowntext'
          6        ECHO                                                     ~4
   50     7      > RETURN                                                   null

End of function myownform_form_submit

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.74 ms | 1399 KiB | 13 Q