- Online PHP Compiler (Interpreter) (PHP v7.1.8)
- How to give program Input?
- Keyboard Shortcuts
- Save Php Project
- Share Php Project
- Code editor online php
- Notes
- Most used PHP functions
- Last used PHP functions
- online compiler and debugger for c/c++
- Compiling Program.
- Program is not being debugged. Click «Debug» button to start program in debug mode.
- Call Stack
- Local Variables
- Registers
- Display Expressions
- Breakpoints and Watchpoints
- Possible reasons for Runtime Exceed error
- New Version Available
- Running Turbo C Project
- Save Project
- Extra Compiler Flags
- Are you sure you want to delete file ` `?
- New File
- Rename File
- Share Link
- Lost connection to server
- Debug session stopped
- Debug mode for python program is not yet supported.
- Login to your account
- Login with
- Run Console session stopped
- Add School/University/Institute
- Keyboard Shortcuts
- PHP Online Compiler
- Taking inputs (stdin)
- About PHP
- Key features
- Syntax help
- Variables
- Loops
- 1. IF Family:
- If
- If-else
- Nested-If-else
- 2. Switch:
- 3. For:
- For-each:
- 4. While:
- 5. Do-While:
- Functions
- How to define a Function
- How to call a Function
Online PHP Compiler (Interpreter) (PHP v7.1.8)
Online PHP Compiler (Interpreter) (PHP v7.1.8) helps you to Edit, Run and Share your Php Code directly from your browser. This development environment provides you version PHP v7.1.8.
How to give program Input?
The latest version of Coding Ground allows to provide program input at run time from the termnial window exactly the same way as you run your program at your own computer. So simply run a program and provide your program input (if any) from the terminal window available in the right side.
Keyboard Shortcuts
Shortcut | Description |
---|---|
⌘ + Enter | Run the program |
⌘ + S | Save Project (Login Required) |
⇧ + ⌘ + S | Save As Project |
⌘ + P | New Project |
⌘ + G | Share Project |
⌘ + Z | Undo Editing |
⌘ + Y | Redo Editing |
⌘ + A | Select All Text |
⌘ + X | Cut Selected Text |
⌘ + C | Copy Selected Text |
⌘ + V | Paste Copied Text |
⌘ + F | Search Text |
⌘ + ⌥ + F | Replace Text |
Shortcut | Description |
---|---|
Ctrl + Enter | Run the program |
Ctrl + S | Save Project |
Shift + Ctrl + S | Save As Project |
Ctrl + G | Share Project |
Ctrl + Z | Undo Editing |
Ctrl + Y | Redo Editing |
Ctrl + A | Select All Text |
Ctrl + X | Cut Selected Text |
Ctrl + C | Copy Selected Text |
Ctrl + V | Paste Copied Text |
Ctrl + F | Search Text |
Ctrl + H | Replace Text |
Save Php Project
You can save your Php Project with us so that you can access this project later on. To save a project you will need to create a login Id with us. So before you save a project, please create a login Id using a link given at the top right corner of this page.
Share Php Project
You can use this feature to share your Php Code with your teachers, classmates and colleagues. Just click Share Button and it will create a short link, which can be shared through Email, WhatsApp or even through Social Media. A shared link will be deleted if it has been passive for almost 3 months.
Code editor online php
07/05/2023: Added PHP 8.3.0alpha3, 8.2.8 and 8.1.21
06/23/2023: Added PHP 8.3.0alpha2
06/22/2023: Added PHP 8.3.0alpha1
06/08/2023: Added PHP 8.0.29
06/07/2023: Added PHP 8.1.20, 8.2.7
Please let me know when you find any bugs or annoyances to help make this website better 🙂
Notes
Network access is rerouted from within the Sandbox, and system access is limited for now. Read about how to use network functions and example files.
If you feel like a function should be enabled/disabled, or if you have any other suggestions, let me know through the comments below or send me an email :).
Looking for the old version?
Check this out: The Legacy Online PHP Sandbox
Most used PHP functions
- sandbox (118356182)
- preg_replace (206859)
- json_encode (145634)
- preg_match (135037)
- unserialize (115687)
- serialize (111257)
- hex2bin (100945)
- uniqid (82046)
- array (72429)
- json_decode (61729)
- iconv (54019)
- utf8_decode (47288)
- preg_replace_callback (47044)
- preg_match_all (45918)
- str_replace (42715)
- strtotime (38823)
Last used PHP functions
- sandbox (10 seconds ago)
- unserialize (10 minutes ago)
- zlib_decode (13 minutes ago)
- serialize (14 minutes ago)
- preg_match_all (20 minutes ago)
- bin2hex (32 minutes ago)
- strlen (33 minutes ago)
- preg_replace (33 minutes ago)
- hex2bin (33 minutes ago)
- hash_hmac (33 minutes ago)
- mb_detect_encoding (36 minutes ago)
- utf8_encode (37 minutes ago)
- html_entity_decode (47 minutes ago)
- password_hash (51 minutes ago)
- ksort (58 minutes ago)
- rawurldecode (1 hour ago)
online compiler and debugger for c/c++
Compiling Program.
Program is not being debugged. Click «Debug» button to start program in debug mode.
Call Stack
Local Variables
Registers
Display Expressions
Breakpoints and Watchpoints
Possible reasons for Runtime Exceed error
- If your program is reading input from standard input and you forgot to provide input via stdin.
- Your program contains infinite loop, which may never break.
- Your program contains infinite recursive function calls.
- May be your program is trying to process large data and it takes much time to process
New Version Available
New Version of OnlineGDB is available. Please save your data and refresh page to update.
Running Turbo C Project
Save Project
Extra Compiler Flags
Are you sure you want to delete file ` `?
New File
Rename File
Share Link
Lost connection to server
Oops! Connection to server is lost. Please refresh the page to reconnect.
Debug session stopped
Debug session is being stopped due to inactivity.
Debug mode for python program is not yet supported.
Login to your account
Login with
Run Console session stopped
Run Console is being stopped due to inactivity.
Add School/University/Institute
Keyboard Shortcuts
IDE Shortcuts: New file : Ctrl-M Run Code : F9 Debug Code : F8 Save Project : Ctrl-S Beautify Code : Ctrl-B Settings Menu : Ctrl-Shift-S Info : Ctrl-I Editor Shortcuts: showSettingsMenu : Ctrl-, goToNextError : Alt-E goToPreviousError : Alt-Shift-E selectall : Ctrl-A gotoline : Ctrl-L fold : Alt-L|Ctrl-F1 unfold : Alt-Shift-L|Ctrl-Shift-F1 toggleFoldWidget : F2 toggleParentFoldWidget : Alt-F2 foldOther : Alt-0 unfoldall : Alt-Shift-0 findnext : Ctrl-K findprevious : Ctrl-Shift-K selectOrFindNext : Alt-K selectOrFindPrevious : Alt-Shift-K find : Ctrl-F overwrite : Insert selecttostart : Ctrl-Shift-Home gotostart : Ctrl-Home selectup : Shift-Up golineup : Up selecttoend : Ctrl-Shift-End gotoend : Ctrl-End selectdown : Shift-Down golinedown : Down selectwordleft : Ctrl-Shift-Left gotowordleft : Ctrl-Left selecttolinestart : Alt-Shift-Left gotolinestart : Alt-Left|Home selectleft : Shift-Left gotoleft : Left selectwordright : Ctrl-Shift-Right gotowordright : Ctrl-Right selecttolineend : Alt-Shift-Right gotolineend : Alt-Right|End selectright : Shift-Right gotoright : Right selectpagedown : Shift-Pagedown gotopagedown : Pagedown selectpageup : Shift-Pageup gotopageup : Pageup scrollup : Ctrl-Up scrolldown : Ctrl-Down selectlinestart : Shift-Home selectlineend : Shift-End togglerecording : Ctrl-Alt-E replaymacro : Ctrl-Shift-E jumptomatching : Ctrl-P selecttomatching : Ctrl-Shift-P expandToMatching : Ctrl-Shift-M removeline : Ctrl-D duplicateSelection : Ctrl-Shift-D sortlines : Ctrl-Alt-S togglecomment : Ctrl-/ toggleBlockComment : Ctrl-Shift-/ modifyNumberUp : Ctrl-Shift-Up modifyNumberDown : Ctrl-Shift-Down replace : Ctrl-H undo : Ctrl-Z redo : Ctrl-Shift-Z|Ctrl-Y copylinesup : Alt-Shift-Up movelinesup : Alt-Up copylinesdown : Alt-Shift-Down movelinesdown : Alt-Down del : Delete backspace : Shift-Backspace|Backspace cut_or_delete : Shift-Delete removetolinestart : Alt-Backspace removetolineend : Alt-Delete removewordleft : Ctrl-Backspace removewordright : Ctrl-Delete outdent : Shift-Tab indent : Tab blockoutdent : Ctrl-[ blockindent : Ctrl-] transposeletters : Ctrl-T touppercase : Ctrl-U tolowercase : Ctrl-Shift-U expandtoline : Ctrl-Shift-L addCursorAbove : Ctrl-Alt-Up addCursorBelow : Ctrl-Alt-Down addCursorAboveSkipCurrent : Ctrl-Alt-Shift-Up addCursorBelowSkipCurrent : Ctrl-Alt-Shift-Down selectMoreBefore : Ctrl-Alt-Left selectMoreAfter : Ctrl-Alt-Right selectNextBefore : Ctrl-Alt-Shift-Left selectNextAfter : Ctrl-Alt-Shift-Right splitIntoLines : Ctrl-Alt-L alignCursors : Ctrl-Alt-A findAll : Ctrl-Alt-K showKeyboardShortcuts : Ctrl-Alt-H
PHP Online Compiler
Write, Run & Share PHP code online using OneCompiler’s PHP online compiler for free. It’s one of the robust, feature-rich online compilers for PHP language, running on the latest version 7. Getting started with the OneCompiler’s PHP compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as PHP and start coding.
Taking inputs (stdin)
OneCompiler’s PHP online editor supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample PHP program which takes name as input and prints hello message with your name.
About PHP
PHP(Hypertext Preprocessor) is widely used server sripting language by Rasmus Lerdorf in the year 1994.
Key features
- Free
- powerful tool for making dynamic and interactive web pages
- can integrate with almost all popular databases like MySQL, PostgreSQL, Oracle, Sybase, Informix, Microsoft SQL Server etc.
- C like Syntax and easy to learn.
- Object oriented scripting language.
- easily embeddable into HTML
- Loosely typed language.
Syntax help
Variables
In PHP, there is no need to explicitly declare variables to reserve memory space. When you assign a value to a variable, declaration happens automatically. Variables are case-sensitive in PHP.
Loops
1. IF Family:
If, If-else, Nested-Ifs are used when you want to perform a certain set of operations based on conditional expressions.
If
If-else
if(conditional-expression) < //code if condition is true >else < //code if condition is false >
Nested-If-else
if(condition-expression1) < //code if above condition is true >elseif(condition-expression2) < //code if above condition is true >elseif(condition-expression3) < //code if above condition is true >. else < //code if all the conditions are false >
2. Switch:
Switch is used to execute one set of statement from multiple conditions.
switch(conditional-expression) < case value1: // code if the above value is matched break; // optional case value2: // code if the above value is matched break; // optional . default: // code to be executed when all the above cases are not matched; >
3. For:
For loop is used to iterate a set of statements based on a condition.
for(Initialization; Condition; Increment/decrement) < // code >
For-each:
// you can use any of the below syntax foreach ($array as $element-value) < //code >foreach ($array as $key => $element-value) < //code >
4. While:
While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.
5. Do-While:
Do-while is also used to iterate a set of statements based on a condition. It is mostly used when you need to execute the statements atleast once.
Functions
Function is a sub-routine which contains set of statements. Usually functions are written when multiple calls are required to same set of statements which increases re-usuability and modularity.
How to define a Function
function function_name(parameters) < //code >