3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * renders tables using json output from API call * * PHP version 5 * * @author Matt Scaperoth <mscapero@gwu.edu> * */ ?> <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> <style> .center-wrapper .panel-pane{ margin-bottom:0; } </style> <h2>GW Lecture Capture Locations</h2> <p>All lecture capture classrooms record instructor audio and presentation materials. Select classrooms are also equipped with a camera to record video of the instructor, along with the audio and presentation materials.</p> <br /> <?php //================================== // MAIN: // edit variables for program here //================================== $API_url = "http://classrooms.at.gwu.edu"; $room_feature_type = "capabilities"; $room_feature_name = "lecture capture enabled"; //get the data //$json = get_data($API_url, $room_feature_type, $room_feature_name); //sort by room number //usort($json, "cmp"); // DATA ORGANIZATION //display names of campuses $foggy_title = "Foggy Bottom Campus"; $mvc_title = "Mount Vernon Campus"; $virginia_title = "Virginia Science and Technology Campus"; //links for pdf maps $foggy_bottom_map_url = "https://acadtech.gwu.edu/files/downloads/Foggy%20Bottom%20Campus%20Map.pdf"; $mount_vernon_map_url = "https://acadtech.gwu.edu/files/downloads/Mount%20Vernon%20Campus%20Map.pdf"; $virginia_map_url = "https://acadtech.gwu.edu/files/downloads/VSTC%20Map.pdf"; //campus details $foggy_info = array( "title" => $foggy_title, "link" => "foggy-bottom", "map" => $foggy_bottom_map_url, "buildings" => array(), "html" => null, "notes" => null, ); $mvc_info = array( "title" => $mvc_title, "link" => "mvc", "map" => $foggy_bottom_map_url, "buildings" => array(), "html" => null, "notes" => "*Equipment in Ames Hall is supported by MVC Faculty & Instructional Support, (202) 242-6670.", ); $vstc_info = array( "title" => $virginia_title, "link" => "vstc", "map" => $foggy_bottom_map_url, "buildings" => array(), "html" => null, "notes" => null, ); //we will store each table as it is created $campuses = array("FB" => $foggy_info, "MVC" => $mvc_info, "VSTC" => $vstc_info); //start by building the tables for each campus foreach ($campuses as $campus_info => $value) { //$campuses[$campus_info]["html"] = open_table($campuses[$campus_info]); } //-------------------------- // Process and Render Data //-------------------------- //generate the html tables using json data and campus info //$campuses = build_html($json, $campuses, $room_feature_name); //clean up the output with styles and sorting //$campuses = clean_output($campuses); //return the output to the screen //render($campuses); //================================== // FUNCTIONS // Here you can edit the output // and the data sources //==================================== //-------------------------- // Output Functions //-------------------------- /** * opens html table * @param array() $campus_info * @return String */ function open_table($campus_info) { return htmlspecialchars("<table border=\"1\" cellpadding=\"1\" cellspacing=\"1\" style=\"width: 100%;\"><tbody>" . "<thead> <tr> <th colspan=\"3\" scope=\"col\" style=\"border-color: rgb(51, 51, 51); background-color: rgb(231, 244, 246);text-align:center\"> {$campus_info['title']} (<a href=\"{$campus_info['link']}\" target=\"_blank\">map</a>) </th> </tr> </thead>"); } /** * (b) closes html table * @param mixed $campus_info */ function close_table($campus_info) { return htmlspecialchars("</tr></tbody></table>"); } /** * cleans upthe output by providing <p> wrappers and adding notes * @param mixed $campuses * @return mixed function clean_output($campuses) { foreach ($campuses as $campus_info => $value) { //set pointers to manipulate $campuses directly $campus_info_ptr = &$campuses[$campus_info]; $html_ptr = &$campus_info_ptr["html"]; $notes_ptr = &$campus_info_ptr["notes"]; //close the tables $html_ptr .= close_table($campus_info_ptr); //wrap tables in <p> tags $html_ptr = "<p>" . $html_ptr . "</p>"; //add notes at the end of output $html_ptr .= $notes_ptr; //sorting ksort($campus_info_ptr["buildings"]); } return $campuses; } */ /** * used by uksort on json to sort buildings and rooms function cmp($a, $b) { if ($a->building_name == $b->building_name) { if ($a->room_num == $b->room_num) { return 0; } //do a second-degree sort on room number if (is_numeric($a->room_num) && !is_numeric($b->room_num)) { return 1; } else if (!is_numeric($a->room_num) && is_numeric($b->room_num)) { return -1; } else { return ($a->room_num < $b->room_num) ? -1 : 1; } } else { //if buildings are different, sort on building name return ($a->building_name < $b->building_name) ? -1 : 1; } } */ /** * echos the html from the room info * @param mixed $campuses array of campus information */ function render($campuses) { if (is_array($campuses) || is_object($campuses)) { foreach ($campuses as $campus_info) { echo $campuses[$campus_info]["html"]; } } } /** * generates tables from json data * @param array(Objects) $json * @param array(array()) $campuses * @return mixed */ function build_html($json, $campuses, $room_feature_name) { //used to filter out unwanted parts of name in building $replace_this_string1 = "MVC-"; $replace_this_string2 = "VSTC-"; $replace_these_strings = "/^$replace_this_string1|^$replace_this_string2/"; //regex //track the number of rooms so far $number_of_rooms = 0; foreach ($json as $item) { $campus = $item->campus; $campus_info = &$campuses[$campus]; //room information $room_num = $item->room_num; $room_class = ""; $room_link = ""; //use this variable to put commas between rooms $room_separator = ""; //trim unwanted characters from building name $item->building_name = preg_replace($replace_these_strings, '', $item->building_name); //start new building var $building = array( "name" => $item->building_name, "old_name" => $item->building_name, ); //format building name to make it look nice $building = format_building_name($building); //if building is not a part of campus info do work if (!in_array($building["name"], $campus_info["buildings"])) { //new building means new room count $number_of_rooms = 0; //if not first building, end previous cell and row if (!empty($campus_info["buildings"])) { //close previous cell $campus_info["html"] .= htmlspecialchars("</td>"); //close previous row $campus_info["html"] .= htmlspecialchars("</tr>"); } //add building to list of buildings array_push($campus_info["buildings"], $building["name"]); //create new row. will be closed in next building or at the end $campus_info["html"] .= htmlspecialchars("<tr>"); //create new cell $campus_info["html"] .= htmlspecialchars("<td width=\"50%\" id=\"{$building['name']}\">"); $campus_info["html"] .= htmlspecialchars($building["name"]); //close building cell $campus_info["html"] .= htmlspecialchars("</td>"); //start new cell for room numbers $campus_info["html"] .= htmlspecialchars("<td width=\"50%\">"); } //if it's not the first room, ad a comma before it $room_separator = $number_of_rooms > 0 ? ", " : ""; //for each building add the rooms //check to see if room has video and add camera icon if necessary if (stripos($room_feature_name, "lecture capture") !== false) { if (in_arrayi("(camera)", $item->equipment)) { $room_class = "fa fa-video-camera"; } } //only grab first "word" in building name to make for easier queries $building_name_no_spaces = strtok($building["old_name"], ' '); //generate the link for the website $room_link = "/location?building=$building_name_no_spaces&room=$room_num"; $campus_info["html"] .= htmlspecialchars("$room_separator<a href=\"$room_link\" target=\"_blank\">$room_num <i class=\"$room_class\"></i></a>"); $number_of_rooms++; } return $campuses; } /** * Case-insensitive in_array() wrapper. * https://gist.github.com/sepehr/6351397 * * @param mixed $needle Value to seek. * @param array $haystack Array to seek in. * * @return bool */ function in_arrayi($needle, $haystack) { foreach ($haystack as $value) { if (stripos($value, $needle) !== false) { return true; } } return false; } /** * formats building name to be more user friendly * @param array() $building * @return array() formatted $building */ function format_building_name($building) { switch ($building["name"]) { case "Ames": $building["old_name"] = $building["name"]; $building["name"] .= ' Hall*'; break; case "Corcoran": case "Discovery": case "Duques": case "Exploration": case "Funger": case "Innovation": case "Phillips": case "Rome": $building["old_name"] = $building["name"]; $building["name"] .= ' Hall'; break; case "Government": $building["old_name"] = $building["name"]; $building["name"] = 'Hall of ' . $building["name"]; break; case "GWSPH": $building["old_name"] = "GWSPH"; $building["name"] = "Milken Institute School of Public Health"; break; case "MPA": $building["old_name"] = "MPA"; $building["name"] = "Media and Public Affairs Building"; break; case "SEH": $building["old_name"] = "SEH"; $building["name"] = "Science and Engineering Hall"; break; } return $building; } //-------------------------- // json Functions //-------------------------- /** * uses API to get classroom data * @param String $room_feature_type item type: capabilities, software, quickcodes, etc. * @param String $room_feature_name name of item to look for: lecture capture, video conferencing, etc. * @return array(Objects) */ function get_data($API_url, $room_feature_type, $room_feature_name) { //get all capabilities available $capabilities = curl("$API_url/api/campuses/$room_feature_type"); //get the ids of the capabilities with lecture capture in the name $ids_of_lect_capt = searchJson($capabilities, "name", $room_feature_name); $rooms = array(); //get the ids of the rooms with lecture capture foreach ($ids_of_lect_capt as $cap_id) { $ids_of_rooms = curl("$API_url/api/campuses/capability/$cap_id/rooms"); foreach ($ids_of_rooms as $room) { array_push($rooms, $room->id); } } $json = array(); //get the details for each of the rooms and add it into one object foreach ($rooms as $room_id) { $room_details = curl("$API_url/api/campuses/building/room/$room_id/details"); array_push($json, $room_details); } return $json; } /** * performs curl * @param String $url * @return array(Objecs) */ function curl($url) { //echo '<h3 class="Legend">PHP</h3>'; // create curl resource $ch = curl_init(); // set url curl_setopt($ch, CURLOPT_URL, $url); //return the transfer as a string curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // $output contains the output string $output = curl_exec($ch); // var_dump(curl_error($ch)); //decode json into array $json = json_decode($output); // close curl resource to free up system resources curl_close($ch); return $json; } /** * returns array of values found * @param array(Objects) $obj * @param String $field * @param String $value * @return array() */ function searchJson($obj, $field, $value) { $result = array(); if (is_array($obj) || is_object($obj)) { foreach ($obj as $item) { foreach ($item as $child) { if (isset($item->id) && stripos($child . $field, $value) !== false) { array_push($result, $item->id); } } } } return $result; } //-------------------------- // Debugging Functions //-------------------------- //formatted output of variable function test($var) { echo "<pre>"; var_dump($var); echo "</pre>"; } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 36, Position 2 = 39
Branch analysis from position: 36
2 jumps found. (Code = 78) Position 1 = 37, Position 2 = 39
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
filename:       /in/dNTN5
function name:  (null)
number of ops:  41
compiled vars:  !0 = $API_url, !1 = $room_feature_type, !2 = $room_feature_name, !3 = $foggy_title, !4 = $mvc_title, !5 = $virginia_title, !6 = $foggy_bottom_map_url, !7 = $mount_vernon_map_url, !8 = $virginia_map_url, !9 = $foggy_info, !10 = $mvc_info, !11 = $vstc_info, !12 = $campuses, !13 = $value, !14 = $campus_info
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ECHO                                                     '%3Clink+href%3D%22%2F%2Fnetdna.bootstrapcdn.com%2Ffont-awesome%2F4.0.3%2Fcss%2Ffont-awesome.css%22+rel%3D%22stylesheet%22%3E%0A%3Cstyle%3E%0A++++.center-wrapper+.panel-pane%7B%0A++++++++margin-bottom%3A0%3B%0A++++%7D%0A%3C%2Fstyle%3E%0A%3Ch2%3EGW+Lecture+Capture+Locations%3C%2Fh2%3E%0A%3Cp%3EAll+lecture+capture+classrooms+record+instructor+audio+and+presentation+materials.+Select+classrooms+are+also+equipped+with+a+camera+to+record+video+of+the+instructor%2C+along+with+the+audio+and+presentation+materials.%3C%2Fp%3E%0A%3Cbr+%2F%3E%0A'
   29     1        ASSIGN                                                   !0, 'http%3A%2F%2Fclassrooms.at.gwu.edu'
   30     2        ASSIGN                                                   !1, 'capabilities'
   31     3        ASSIGN                                                   !2, 'lecture+capture+enabled'
   42     4        ASSIGN                                                   !3, 'Foggy+Bottom+Campus'
   43     5        ASSIGN                                                   !4, 'Mount+Vernon+Campus'
   44     6        ASSIGN                                                   !5, 'Virginia+Science+and+Technology+Campus'
   47     7        ASSIGN                                                   !6, 'https%3A%2F%2Facadtech.gwu.edu%2Ffiles%2Fdownloads%2FFoggy%2520Bottom%2520Campus%2520Map.pdf'
   48     8        ASSIGN                                                   !7, 'https%3A%2F%2Facadtech.gwu.edu%2Ffiles%2Fdownloads%2FMount%2520Vernon%2520Campus%2520Map.pdf'
   49     9        ASSIGN                                                   !8, 'https%3A%2F%2Facadtech.gwu.edu%2Ffiles%2Fdownloads%2FVSTC%2520Map.pdf'
   53    10        INIT_ARRAY                                       ~24     !3, 'title'
   54    11        ADD_ARRAY_ELEMENT                                ~24     'foggy-bottom', 'link'
   55    12        ADD_ARRAY_ELEMENT                                ~24     !6, 'map'
   53    13        ADD_ARRAY_ELEMENT                                ~24     <array>, 'buildings'
         14        ADD_ARRAY_ELEMENT                                ~24     null, 'html'
         15        ADD_ARRAY_ELEMENT                                ~24     null, 'notes'
   52    16        ASSIGN                                                   !9, ~24
   61    17        INIT_ARRAY                                       ~26     !4, 'title'
   62    18        ADD_ARRAY_ELEMENT                                ~26     'mvc', 'link'
   63    19        ADD_ARRAY_ELEMENT                                ~26     !6, 'map'
   61    20        ADD_ARRAY_ELEMENT                                ~26     <array>, 'buildings'
         21        ADD_ARRAY_ELEMENT                                ~26     null, 'html'
   66    22        ADD_ARRAY_ELEMENT                                ~26     '%2AEquipment+in+Ames+Hall+is+supported+by+MVC+Faculty+%26+Instructional+Support%2C+%28202%29+242-6670.', 'notes'
   60    23        ASSIGN                                                   !10, ~26
   69    24        INIT_ARRAY                                       ~28     !5, 'title'
   70    25        ADD_ARRAY_ELEMENT                                ~28     'vstc', 'link'
   71    26        ADD_ARRAY_ELEMENT                                ~28     !6, 'map'
   69    27        ADD_ARRAY_ELEMENT                                ~28     <array>, 'buildings'
         28        ADD_ARRAY_ELEMENT                                ~28     null, 'html'
         29        ADD_ARRAY_ELEMENT                                ~28     null, 'notes'
   68    30        ASSIGN                                                   !11, ~28
   78    31        INIT_ARRAY                                       ~30     !9, 'FB'
         32        ADD_ARRAY_ELEMENT                                ~30     !10, 'MVC'
         33        ADD_ARRAY_ELEMENT                                ~30     !11, 'VSTC'
         34        ASSIGN                                                   !12, ~30
   81    35      > FE_RESET_R                                       $32     !12, ->39
         36    > > FE_FETCH_R                                       ~33     $32, !13, ->39
         37    >   ASSIGN                                                   !14, ~33
         38      > JMP                                                      ->36
         39    >   FE_FREE                                                  $32
  467    40      > RETURN                                                   1

Function open_table:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dNTN5
function name:  open_table
number of ops:  14
compiled vars:  !0 = $campus_info
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  113     0  E >   RECV                                             !0      
  115     1        INIT_FCALL                                               'htmlspecialchars'
  116     2        ROPE_INIT                                     5  ~4      '%3Cthead%3E%0A++++++++++++++++++++++++%3Ctr%3E%0A++++++++++++++++++++++++++++%3Cth+colspan%3D%223%22+scope%3D%22col%22++style%3D%22border-color%3A+rgb%2851%2C+51%2C+51%29%3B+background-color%3A+rgb%28231%2C+244%2C+246%29%3Btext-align%3Acenter%22%3E%0A++++++++++++++++++++++++++++++++'
  119     3        FETCH_DIM_R                                      ~1      !0, 'title'
          4        ROPE_ADD                                      1  ~4      ~4, ~1
          5        ROPE_ADD                                      2  ~4      ~4, '+%28%3Ca+href%3D%22'
          6        FETCH_DIM_R                                      ~2      !0, 'link'
          7        ROPE_ADD                                      3  ~4      ~4, ~2
          8        ROPE_END                                      4  ~3      ~4, '%22+target%3D%22_blank%22%3Emap%3C%2Fa%3E%29%0A++++++++++++++++++++++++++++%3C%2Fth%3E%0A++++++++++++++++++++++++%3C%2Ftr%3E%0A++++++++++++++++++++%3C%2Fthead%3E'
          9        CONCAT                                           ~7      '%3Ctable+border%3D%221%22+cellpadding%3D%221%22+cellspacing%3D%221%22+style%3D%22width%3A+100%25%3B%22%3E%3Ctbody%3E', ~3
         10        SEND_VAL                                                 ~7
         11        DO_ICALL                                         $8      
         12      > RETURN                                                   $8
  124    13*     > RETURN                                                   null

End of function open_table

Function close_table:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dNTN5
function name:  close_table
number of ops:  6
compiled vars:  !0 = $campus_info
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  130     0  E >   RECV                                             !0      
  132     1        INIT_FCALL                                               'htmlspecialchars'
          2        SEND_VAL                                                 '%3C%2Ftr%3E%3C%2Ftbody%3E%3C%2Ftable%3E'
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
  134     5*     > RETURN                                                   null

End of function close_table

Function render:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 13
Branch analysis from position: 6
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
Branch analysis from position: 13
Branch analysis from position: 5
filename:       /in/dNTN5
function name:  render
number of ops:  14
compiled vars:  !0 = $campuses, !1 = $campus_info
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  195     0  E >   RECV                                             !0      
  198     1        TYPE_CHECK                                  128  ~2      !0
          2      > JMPNZ_EX                                         ~2      ~2, ->5
          3    >   TYPE_CHECK                                  256  ~3      !0
          4        BOOL                                             ~2      ~3
          5    > > JMPZ                                                     ~2, ->13
  199     6    > > FE_RESET_R                                       $4      !0, ->12
          7    > > FE_FETCH_R                                               $4, !1, ->12
  200     8    >   FETCH_DIM_R                                      ~5      !0, !1
          9        FETCH_DIM_R                                      ~6      ~5, 'html'
         10        ECHO                                                     ~6
  199    11      > JMP                                                      ->7
         12    >   FE_FREE                                                  $4
  203    13    > > RETURN                                                   null

End of function render

Function build_html:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 144
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 144
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 48, Position 2 = 98
Branch analysis from position: 48
2 jumps found. (Code = 43) Position 1 = 52, Position 2 = 62
Branch analysis from position: 52
2 jumps found. (Code = 43) Position 1 = 100, Position 2 = 102
Branch analysis from position: 100
1 jumps found. (Code = 42) Position 1 = 103
Branch analysis from position: 103
2 jumps found. (Code = 43) Position 1 = 110, Position 2 = 118
Branch analysis from position: 110
2 jumps found. (Code = 43) Position 1 = 117, Position 2 = 118
Branch analysis from position: 117
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 118
Branch analysis from position: 118
Branch analysis from position: 102
2 jumps found. (Code = 43) Position 1 = 110, Position 2 = 118
Branch analysis from position: 110
Branch analysis from position: 118
Branch analysis from position: 62
Branch analysis from position: 98
Branch analysis from position: 144
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 144
filename:       /in/dNTN5
function name:  build_html
number of ops:  147
compiled vars:  !0 = $json, !1 = $campuses, !2 = $room_feature_name, !3 = $replace_this_string1, !4 = $replace_this_string2, !5 = $replace_these_strings, !6 = $number_of_rooms, !7 = $item, !8 = $campus, !9 = $campus_info, !10 = $room_num, !11 = $room_class, !12 = $room_link, !13 = $room_separator, !14 = $building, !15 = $building_name_no_spaces
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  211     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
  215     3        ASSIGN                                                   !3, 'MVC-'
  216     4        ASSIGN                                                   !4, 'VSTC-'
  217     5        ROPE_INIT                                     5  ~19     '%2F%5E'
          6        ROPE_ADD                                      1  ~19     ~19, !3
          7        ROPE_ADD                                      2  ~19     ~19, '%7C%5E'
          8        ROPE_ADD                                      3  ~19     ~19, !4
          9        ROPE_END                                      4  ~18     ~19, '%2F'
         10        ASSIGN                                                   !5, ~18
  220    11        ASSIGN                                                   !6, 0
  222    12      > FE_RESET_R                                       $24     !0, ->144
         13    > > FE_FETCH_R                                               $24, !7, ->144
  223    14    >   FETCH_OBJ_R                                      ~25     !7, 'campus'
         15        ASSIGN                                                   !8, ~25
  224    16        FETCH_DIM_W                                      $27     !1, !8
         17        ASSIGN_REF                                               !9, $27
  227    18        FETCH_OBJ_R                                      ~29     !7, 'room_num'
         19        ASSIGN                                                   !10, ~29
  228    20        ASSIGN                                                   !11, ''
  229    21        ASSIGN                                                   !12, ''
  231    22        ASSIGN                                                   !13, ''
  234    23        INIT_FCALL                                               'preg_replace'
         24        SEND_VAR                                                 !5
         25        SEND_VAL                                                 ''
         26        FETCH_OBJ_R                                      ~35     !7, 'building_name'
         27        SEND_VAL                                                 ~35
         28        DO_ICALL                                         $36     
         29        ASSIGN_OBJ                                               !7, 'building_name'
         30        OP_DATA                                                  $36
  238    31        FETCH_OBJ_R                                      ~37     !7, 'building_name'
         32        INIT_ARRAY                                       ~38     ~37, 'name'
  239    33        FETCH_OBJ_R                                      ~39     !7, 'building_name'
         34        ADD_ARRAY_ELEMENT                                ~38     ~39, 'old_name'
  237    35        ASSIGN                                                   !14, ~38
  243    36        INIT_FCALL_BY_NAME                                       'format_building_name'
         37        SEND_VAR_EX                                              !14
         38        DO_FCALL                                      0  $41     
         39        ASSIGN                                                   !14, $41
  246    40        INIT_FCALL                                               'in_array'
         41        FETCH_DIM_R                                      ~43     !14, 'name'
         42        SEND_VAL                                                 ~43
         43        FETCH_DIM_R                                      ~44     !9, 'buildings'
         44        SEND_VAL                                                 ~44
         45        DO_ICALL                                         $45     
         46        BOOL_NOT                                         ~46     $45
         47      > JMPZ                                                     ~46, ->98
  249    48    >   ASSIGN                                                   !6, 0
  252    49        ISSET_ISEMPTY_DIM_OBJ                         1  ~48     !9, 'buildings'
         50        BOOL_NOT                                         ~49     ~48
         51      > JMPZ                                                     ~49, ->62
  255    52    >   INIT_FCALL                                               'htmlspecialchars'
         53        SEND_VAL                                                 '%3C%2Ftd%3E'
         54        DO_ICALL                                         $51     
         55        ASSIGN_DIM_OP                .=               8          !9, 'html'
         56        OP_DATA                                                  $51
  257    57        INIT_FCALL                                               'htmlspecialchars'
         58        SEND_VAL                                                 '%3C%2Ftr%3E'
         59        DO_ICALL                                         $53     
         60        ASSIGN_DIM_OP                .=               8          !9, 'html'
         61        OP_DATA                                                  $53
  261    62    >   INIT_FCALL                                               'array_push'
         63        FETCH_DIM_W                                      $54     !9, 'buildings'
         64        SEND_REF                                                 $54
         65        FETCH_DIM_R                                      ~55     !14, 'name'
         66        SEND_VAL                                                 ~55
         67        DO_ICALL                                                 
  264    68        INIT_FCALL                                               'htmlspecialchars'
         69        SEND_VAL                                                 '%3Ctr%3E'
         70        DO_ICALL                                         $58     
         71        ASSIGN_DIM_OP                .=               8          !9, 'html'
         72        OP_DATA                                                  $58
  267    73        INIT_FCALL                                               'htmlspecialchars'
         74        ROPE_INIT                                     3  ~62     '%3Ctd+width%3D%2250%25%22+id%3D%22'
         75        FETCH_DIM_R                                      ~60     !14, 'name'
         76        ROPE_ADD                                      1  ~62     ~62, ~60
         77        ROPE_END                                      2  ~61     ~62, '%22%3E'
         78        SEND_VAL                                                 ~61
         79        DO_ICALL                                         $64     
         80        ASSIGN_DIM_OP                .=               8          !9, 'html'
         81        OP_DATA                                                  $64
  269    82        INIT_FCALL                                               'htmlspecialchars'
         83        FETCH_DIM_R                                      ~66     !14, 'name'
         84        SEND_VAL                                                 ~66
         85        DO_ICALL                                         $67     
         86        ASSIGN_DIM_OP                .=               8          !9, 'html'
         87        OP_DATA                                                  $67
  272    88        INIT_FCALL                                               'htmlspecialchars'
         89        SEND_VAL                                                 '%3C%2Ftd%3E'
         90        DO_ICALL                                         $69     
         91        ASSIGN_DIM_OP                .=               8          !9, 'html'
         92        OP_DATA                                                  $69
  275    93        INIT_FCALL                                               'htmlspecialchars'
         94        SEND_VAL                                                 '%3Ctd+width%3D%2250%25%22%3E'
         95        DO_ICALL                                         $71     
         96        ASSIGN_DIM_OP                .=               8          !9, 'html'
         97        OP_DATA                                                  $71
  280    98    >   IS_SMALLER                                               0, !6
         99      > JMPZ                                                     ~72, ->102
        100    >   QM_ASSIGN                                        ~73     '%2C+'
        101      > JMP                                                      ->103
        102    >   QM_ASSIGN                                        ~73     ''
        103    >   ASSIGN                                                   !13, ~73
  284   104        INIT_FCALL                                               'stripos'
        105        SEND_VAR                                                 !2
        106        SEND_VAL                                                 'lecture+capture'
        107        DO_ICALL                                         $75     
        108        TYPE_CHECK                                  1018          $75
        109      > JMPZ                                                     ~76, ->118
  285   110    >   INIT_FCALL_BY_NAME                                       'in_arrayi'
        111        SEND_VAL_EX                                              '%28camera%29'
        112        CHECK_FUNC_ARG                                           
        113        FETCH_OBJ_FUNC_ARG                               $77     !7, 'equipment'
        114        SEND_FUNC_ARG                                            $77
        115        DO_FCALL                                      0  $78     
        116      > JMPZ                                                     $78, ->118
  286   117    >   ASSIGN                                                   !11, 'fa+fa-video-camera'
  291   118    >   INIT_FCALL                                               'strtok'
        119        FETCH_DIM_R                                      ~80     !14, 'old_name'
        120        SEND_VAL                                                 ~80
        121        SEND_VAL                                                 '+'
        122        DO_ICALL                                         $81     
        123        ASSIGN                                                   !15, $81
  293   124        ROPE_INIT                                     4  ~84     '%2Flocation%3Fbuilding%3D'
        125        ROPE_ADD                                      1  ~84     ~84, !15
        126        ROPE_ADD                                      2  ~84     ~84, '%26room%3D'
        127        ROPE_END                                      3  ~83     ~84, !10
        128        ASSIGN                                                   !12, ~83
  295   129        INIT_FCALL                                               'htmlspecialchars'
        130        ROPE_INIT                                     8  ~89     !13
        131        ROPE_ADD                                      1  ~89     ~89, '%3Ca+href%3D%22'
        132        ROPE_ADD                                      2  ~89     ~89, !12
        133        ROPE_ADD                                      3  ~89     ~89, '%22+target%3D%22_blank%22%3E'
        134        ROPE_ADD                                      4  ~89     ~89, !10
        135        ROPE_ADD                                      5  ~89     ~89, '+%3Ci+class%3D%22'
        136        ROPE_ADD                                      6  ~89     ~89, !11
        137        ROPE_END                                      7  ~88     ~89, '%22%3E%3C%2Fi%3E%3C%2Fa%3E'
        138        SEND_VAL                                                 ~88
        139        DO_ICALL                                         $93     
        140        ASSIGN_DIM_OP                .=               8          !9, 'html'
        141        OP_DATA                                                  $93
  297   142        PRE_INC                                                  !6
  222   143      > JMP                                                      ->13
        144    >   FE_FREE                                                  $24
  300   145      > RETURN                                                   !1
  301   146*     > RETURN                                                   null

End of function build_html

Function in_arrayi:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 13
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/dNTN5
function name:  in_arrayi
number of ops:  16
compiled vars:  !0 = $needle, !1 = $haystack, !2 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  312     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  314     2      > FE_RESET_R                                       $3      !1, ->13
          3    > > FE_FETCH_R                                               $3, !2, ->13
  315     4    >   INIT_FCALL                                               'stripos'
          5        SEND_VAR                                                 !2
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $4      
          8        TYPE_CHECK                                  1018          $4
          9      > JMPZ                                                     ~5, ->12
  316    10    >   FE_FREE                                                  $3
         11      > RETURN                                                   <true>
  314    12    > > JMP                                                      ->3
         13    >   FE_FREE                                                  $3
  319    14      > RETURN                                                   <false>
  320    15*     > RETURN                                                   null

End of function in_arrayi

Function format_building_name:
Finding entry points
Branch analysis from position: 0
15 jumps found. (Code = 188) Position 1 = 30, Position 2 = 36, Position 3 = 36, Position 4 = 36, Position 5 = 36, Position 6 = 36, Position 7 = 36, Position 8 = 36, Position 9 = 36, Position 10 = 42, Position 11 = 50, Position 12 = 55, Position 13 = 60, Position 14 = 65, Position 15 = 3
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 65
Branch analysis from position: 65
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 65
Branch analysis from position: 65
Branch analysis from position: 36
Branch analysis from position: 36
Branch analysis from position: 36
Branch analysis from position: 36
Branch analysis from position: 36
Branch analysis from position: 36
Branch analysis from position: 36
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 65
Branch analysis from position: 65
Branch analysis from position: 50
1 jumps found. (Code = 42) Position 1 = 65
Branch analysis from position: 65
Branch analysis from position: 55
1 jumps found. (Code = 42) Position 1 = 65
Branch analysis from position: 65
Branch analysis from position: 60
1 jumps found. (Code = 42) Position 1 = 65
Branch analysis from position: 65
Branch analysis from position: 65
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 5, Position 2 = 30
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 7, Position 2 = 36
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 36
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 36
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 36
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 36
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 36
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 36
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 36
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 42
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 50
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 55
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 60
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 65
Branch analysis from position: 65
Branch analysis from position: 60
Branch analysis from position: 55
Branch analysis from position: 50
Branch analysis from position: 42
Branch analysis from position: 36
Branch analysis from position: 36
Branch analysis from position: 36
Branch analysis from position: 36
Branch analysis from position: 36
Branch analysis from position: 36
Branch analysis from position: 36
Branch analysis from position: 36
Branch analysis from position: 30
filename:       /in/dNTN5
function name:  format_building_name
number of ops:  68
compiled vars:  !0 = $building
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  328     0  E >   RECV                                             !0      
  330     1        FETCH_DIM_R                                      ~1      !0, 'name'
          2      > SWITCH_STRING                                            ~1, [ 'Ames':->30, 'Corcoran':->36, 'Discovery':->36, 'Duques':->36, 'Exploration':->36, 'Funger':->36, 'Innovation':->36, 'Phillips':->36, 'Rome':->36, 'Government':->42, 'GWSPH':->50, 'MPA':->55, 'SEH':->60, ], ->65
  331     3    >   CASE                                                     ~1, 'Ames'
          4      > JMPNZ                                                    ~2, ->30
  335     5    >   CASE                                                     ~1, 'Corcoran'
          6      > JMPNZ                                                    ~2, ->36
  336     7    >   CASE                                                     ~1, 'Discovery'
          8      > JMPNZ                                                    ~2, ->36
  337     9    >   CASE                                                     ~1, 'Duques'
         10      > JMPNZ                                                    ~2, ->36
  338    11    >   CASE                                                     ~1, 'Exploration'
         12      > JMPNZ                                                    ~2, ->36
  339    13    >   CASE                                                     ~1, 'Funger'
         14      > JMPNZ                                                    ~2, ->36
  340    15    >   CASE                                                     ~1, 'Innovation'
         16      > JMPNZ                                                    ~2, ->36
  341    17    >   CASE                         

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
180.5 ms | 1428 KiB | 25 Q