Chapter 4: Using the Playground
Don't have HolyPHP installed yet? No problem! You can write and run HolyPHP code directly in your browser using the HolyPHP Playground.
What is the Playground?
The HolyPHP Playground is a browser-based IDE with online code execution. It features:
- Syntax Highlighting - Beautiful code coloring for HolyPHP
- Code Editor - Full-featured editor with line numbers and brackets matching
- Online Compiler - Actually compile and run your code in a secure sandbox
- Examples Library - Learn from ready-to-run examples
- Quick Reference - Handy cheatsheets at your fingertips
Accessing the Playground
You can access the playground at:
Playground Interface
The playground is divided into several sections:
| Section | Purpose |
|---|---|
| Sidebar (Left) | Examples, Quick Reference, and Resources |
| Editor (Center) | Write your HolyPHP code here with syntax highlighting |
| Output Panel (Right) | See the results of your program |
| Toolbar (Top) | Run, Check, Save, and other actions |
Running Your First Program
- Open the Playground
- Type your code in the editor (or load an example)
- Click the "▶ Run" button
- See the output in the right panel
Using Examples
The sidebar has many ready-to-run examples. Click any example to load it into the editor, then click Run to see it in action.
Great examples to try first:
- Hello World - The basics
- Fibonacci - Recursion and functions
- Classes & Objects - OOP in HolyPHP
- Arrays & Maps - Working with data
Safety & Security
The playground runs your code in a secure, sandboxed environment. This means:
- Your code cannot access the filesystem outside the sandbox
- Network access is restricted
- System calls are limited
- Each execution is isolated
This is safe for learning and experimentation!
Tips for Using the Playground
- Use "✓ Check" to quickly check for syntax and type errors without running
- Use "💾 Save" to download your code as a
.hphpfile - Use "📄 New" to start fresh
- Check the Quick Reference in the sidebar for syntax reminders
ui library, you'll need the local compiler installed. The playground is best for console programs.
Show a hint
Take one small step at a time. Follow the instructions above, write down the result you expect, and compare it with what your terminal or Playground shows. If a command fails, check the filename and that you opened a new terminal after installation.