A PHP Error was encountered

Severity: 8192

Message: Function create_function() is deprecated

Filename: geshi/geshi.php

Line Number: 4698

Backtrace:

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4698
Function: _error_handler

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4621
Function: _optimize_regexp_list_tokens_to_string

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 1655
Function: optimize_regexp_list

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2029
Function: optimize_keyword_group

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2168
Function: build_parse_cache

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/Process.php
Line: 45
Function: parse_code

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/models/Pastes.php
Line: 517
Function: syntax

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
Line: 693
Function: getPaste

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
Line: 315
Function: require_once

Untitled - Stikked
From Gracious Goose, 9 Years ago, written in PHP.
Embed
  1. <?php
  2.  
  3. use PhpSchool\CliMenu\CliMenu;
  4. use PhpSchool\CliMenu\CliMenuBuilder;
  5. use PhpSchool\CliMenu\MenuItem\LineBreakItem;
  6. use PhpSchool\CliMenu\MenuItem\MenuItemInterface;
  7.  
  8. require_once(__DIR__ . '/../vendor/autoload.php');
  9.  
  10. $itemCallable = function (CliMenu $menu) {
  11.     $colour = function () {
  12.         return array_rand(array_flip(['blue', 'green', 'red', 'yellow']));
  13.     };
  14.     $int = function () {
  15.         return rand(1, 20);
  16.     };
  17.  
  18.     $bg = $colour();
  19.     while (($fg = $colour()) === $bg) {
  20.     }
  21.    
  22.     $menu->getStyle()->setBg($bg);
  23.     $menu->getStyle()->setFg($fg);
  24.     $menu->getStyle()->setPadding($int());
  25.     $menu->getStyle()->setMargin($int());
  26.  
  27.     $items = $menu->getItems();
  28.    
  29.     array_walk($items, function (MenuItemInterface $item) use ($menu) {
  30.         $menu->removeItem($item);
  31.     });
  32.  
  33.     $items = array_filter($items, function (MenuItemInterface $item) {
  34.         return !$item instanceof LineBreakItem;
  35.     });
  36.  
  37.     foreach (range(0, rand(1, 5)) as $i) {
  38.         $items[] = new LineBreakItem(array_rand(array_flip(['♥', '★', '? '])), rand(1, 3));
  39.     }
  40.     shuffle($items);
  41.  
  42.     array_walk(
  43.         $items,
  44.         function (MenuItemInterface $item) use ($menu) {
  45.             $menu->addItem($item);
  46.         }
  47.     );
  48.    
  49.     $menu->redraw();
  50. };
  51.  
  52. $menu = (new CliMenuBuilder)
  53.     ->setTitle('Basic CLI Menu')
  54.     ->setWidth(80)
  55.     ->addItem('First Item', $itemCallable)
  56.     ->addItem('Second Item', $itemCallable)
  57.     ->addItem('Third Item', $itemCallable)
  58.     ->addLineBreak('-')
  59.     ->build();
  60.  
  61. $menu->open();