ssss - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of ssss.php

  1. <!-- form_helper.php -->
  2. <!DOCTYPE html>
  3. <html>
  4. <body>
  5.  
  6. <?php
  7. class FormHelper {
  8.     public static function extractTitlesForWBForm($input_string) {
  9.         $titles = explode('|', $input_string);
  10.         array_splice($titles, 0, 3);
  11.  
  12.         $title_variables = [
  13.             'NAME' => 'Name',
  14.             'MAIL' => 'Email',
  15.             'PHON' => 'Phone',
  16.             'COMP' => 'Company',
  17.             'ADRE' => 'Address',
  18.             'NOTE' => 'Note',
  19.             'AVTNOTE' => 'Avatar Evaluation',
  20.             'OBJ' => 'Object',
  21.             'COM' => 'Comment'
  22.         ];
  23.  
  24.         $iframe_title = '';
  25.  
  26.         
  27.         foreach ($titles as $title) {
  28.             if (isset($title_variables[$title])) {
  29.                 $iframe_title .= $title_variables[$title] . ', ';
  30.             }
  31.         }
  32.  
  33.         
  34.         $iframe_title = rtrim($iframe_title, ', ');
  35.  
  36.         return $iframe_title;
  37.     }
  38. }
  39.  
  40.  
  41. $consign = 'WBform:__Qb|engine_88_8989899aaa|S5|NAME*|MAIL*|PHON|COMP|ADRE|NOTE|AVTNOTE|OBJ|COM';
  42. $iframe_title = FormHelper::extractTitlesForWBForm($consign);
  43. echo $iframe_title; 
  44. ?>
  45.  
  46. </body>
  47. </html>
  48.  
File Description
  • ssss
  • PHP Code
  • 22 Feb-2024
  • 1.07 Kb
You can Share it: