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 xwlee, 10 Years ago, written in JavaScript.
Embed
  1. // Recursion - A function calls itself until it doesn't
  2.  
  3. let countDownFrom = (num) => {
  4.     if (num === 0) return;
  5.     console.log(num)
  6.     countDownFrom(num - 1)
  7. }
  8.  
  9. countDownFrom(10)
  10.  
  11. // Should output
  12. // 10,
  13. // 9,
  14. // 8,
  15. // ...
  16. // 1
  17.  
  18. let categories = [
  19.     { id: 'animals', 'parent': null },
  20.     { id: 'mammals', 'parent': 'animals' },
  21.     { id: 'cats', 'parent': 'mammals' },
  22.     { id: 'dogs', 'parent': 'mammals' },
  23.     { id: 'chihuahua', 'parent': 'dogs' },
  24.     { id: 'labrador', 'parent': 'dogs' },
  25.     { id: 'persian', 'parent': 'cats' },
  26.     { id: 'siamese', 'parent': 'cats' },
  27. ]
  28.  
  29. let makeTree = (categories, parent) => {
  30.     let node = {}
  31.     categories
  32.         .filter(c => c.parent === parent)
  33.         .forEach(c => node[c.id] =
  34.             makeTree(categories, c.id))
  35.     return node
  36. }
  37.  
  38. console.log(
  39.     JSON.stringify(
  40.         makeTree(categories, null)
  41.     , null, 2)
  42. )
  43.  
  44. /*
  45. {
  46.     "animals": {
  47.         "mammals": {
  48.             "dogs": {
  49.                 "chihuahua": {},
  50.                 "labrador": {},
  51.             },
  52.             "cats": {
  53.                 "persian": {},
  54.                 "siamese": {}
  55.             }
  56.         }
  57.     }
  58. }
  59. */
  60.