xy - 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 xy.php

  1. <?php
  2.         // Draw job postings from Personio API 
  3.         $hostname = 'personio'
  4.         $lang = getLang(); // Depending on implementation of multilingual content
  5.         $positions = simplexml_load_file('https://' . $hostname . '-jobs.personio.de/xml?language=' . $lang);
  6.         $categories = [];
  7.         foreach ($positions->position as $position){
  8.                 $category = (string)$position->recruitingCategory;
  9.                 if($category && !in_array($category, $categories)){
  10.                         $categories[] = $category;
  11.                 }
  12.         }
  13.         $translations = [
  14.                 "full-time" =>        [
  15.                         "de" => "Vollzeit",
  16.                         "en" => "Full-time"
  17.                 ],
  18.                 "part-time" =>  [
  19.                                     "de" => "Teilzeit",
  20.                                     "en" => "Part-time"
  21.                             ],
  22.                 "permanent" =>  [
  23.                                     "de" => "Festanstellung",
  24.                                     "en" => "Permanent Employment"
  25.                             ],
  26.                 "intern" =>  [
  27.                                     "de" => "Praktikum",
  28.                                     "en" => "Internship"
  29.                             ],
  30.                 "trainee" =>  [
  31.                                     "de" => "Trainee Stelle",
  32.                                     "en" => "Trainee Stelle"
  33.                             ],
  34.                 "freelance" =>  [
  35.                                     "de" => "Freelance Position",
  36.                                     "en" => "Freelance Position"
  37.                             ],
  38.         ];
  39.  
  40.         // Print job postings
  41.         foreach ($positions as $position) {
  42.                 $detailLink = 'https://' . $hostname . '-jobs.personio.de/job/' . $position->id;
  43.                 if ($_GET["channel"]) {
  44.                        $detailLink .= '?_pc=' . $_GET["channel"]; 
  45.                }
  46.                 echo '<a href="' . $detailLink . ' target="_blank" alt="Job Details">' .
  47.                                 '<h2>' . $position->name . '</h2>' .
  48.                                 '<p>' . $translations[(string)$position->employmentType][$lang] . ', ' . $translations[(string)$position->schedule][$lang] . '</p>' .
  49.                          '</a>';
  50.         }
  51. ?>
File Description
  • xy
  • PHP Code
  • 15 Aug-2018
  • 1.91 Kb
You can Share it: