- 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
- Запуск кода php online
- 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 Песочница
- Сохранить
- Результат выполнения php
- О PHP онлайн
- Что такое PHP?
- Что такое онлайн PHP песочница?
- Могу ли я запустить PHP программу онлайн?
- Как проверить синтаксис PHP онлайн?
- Зачем нужно запускать PHP скрипт онлайн?
- PHP Online Compiler
- Example
- Publish Your Code
- Learn Faster
- Easy Package Management
- Build Powerful Websites
- Share Your Website With The World
- How Does It Work?
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 >
How to call a Function
Запуск кода php online
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 (118609897)
- preg_replace (207084)
- json_encode (146014)
- preg_match (135288)
- unserialize (116220)
- serialize (111954)
- hex2bin (101258)
- uniqid (82524)
- array (72629)
- json_decode (61953)
- iconv (54082)
- utf8_decode (47395)
- preg_replace_callback (47048)
- preg_match_all (46033)
- str_replace (42843)
- strtotime (38886)
Last used PHP functions
- sandbox (1 second ago)
- soundex (1 minute ago)
- unserialize (2 minutes ago)
- serialize (2 minutes ago)
- utf8_decode (9 minutes ago)
- long2ip (9 minutes ago)
- json_encode (12 minutes ago)
- mb_detect_encoding (15 minutes ago)
- ceil (20 minutes ago)
- hex2bin (23 minutes ago)
- mb_convert_encoding (23 minutes ago)
- str_replace (33 minutes ago)
- json_decode (37 minutes ago)
- strlen (44 minutes ago)
- base64_decode (45 minutes ago)
- cal_days_in_month (46 minutes 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 Песочница
Считаете ли вы этот инструмент полезным? То поделитесь этим с друзьями или коллегами. Это поможет нам сделать наши бесплатные веб-инструменты лучше.
Введите свой PHP код здесь для тестирования/отладки в онлайн PHP песочнице. Как и в обычных PHP файлах, вы также можете добавить HTML, но не забудьте добавить тег
Сохранить
Информация о встраивании
Чтобы встроить этот контент в свой веб-сайт или блог, просто скопируйте и вставьте один из приведенных ниже кодов.
1. JavaScript Встраивание (показывает полный код, полную высоту в зависимости от количества вставляемых строк)
2. Iframe Встраивание (например, вы можете установить высоту фрейма, добавив значение CSS ‘height:100px;’)
Результат выполнения php
О PHP онлайн
Что такое PHP?
PHP (Hypertext PreProcessor) — PHP это язык сценариев на стороне сервера, разработанный в первую очередь для веб-разработки. Код PHP может быть встроен в HTML или может использоваться в сочетании с различными системами веб-шаблонов, системами управления веб-контентом и веб-фреймворками.
Что такое онлайн PHP песочница?
Онлайн PHP Песочница была создана для отладки, тестирования и запуска вашего php кода онлайн. Также это позволяет разработчикам делиться своим PHP кодом с сообществом. Этот инструмент работает с белым списком функций. Все функции, для которых требуется доступ к диску, системе или сети, занесены в черный список, другие — в белый. Максимальное время выполнения составляет 3 секунды.
Если вы обнаружите отключенную функцию, которая должна быть в белом списке или если у вас возникнут другие проблемы, пожалуйста, свяжитесь с нами.
Для разрыва строки эхо-вывода в режиме CLI необходимо использовать PHP_EOL или \n
Протестируйте свой PHP код онлайн без необходимости веб-сервера.
Могу ли я запустить PHP программу онлайн?
С помощью нашего инструмента вы можете редактировать PHP-код и просматривать результат в своем браузере.
Просто вставьте свой PHP-код в текстовое поле выше и нажмите кнопку «Выполнить», и вы получите результат выполнения PHP Онлайн.
Как проверить синтаксис PHP онлайн?
С помощью нашего инструмента вы можете вставить ваш код в PHP редоактор и он сразу же покажет синтаксические ошибки если они есть. А также вы можете попробовать запустить свой код онлайн для нахождения более скрытых проблем и ошибок.
Зачем нужно запускать PHP скрипт онлайн?
Очень часто разработчикам бывает нужно протестировать какую-то маленькую логику, и быстрее ее проверить в нашем PHP компилере, чем создавать отдельный скрипт и проверять его на своем локальном сервере или на удаленном сервер.
PHP Online Compiler
With our online PHP compiler, you can edit PHP code, and view the result in your browser.
Example
Click on the «Try it Yourself» button to see how it works.
Publish Your Code
Create your own website and PHP applications with W3Schools Spaces.
W3Schools Spaces is a website-building tool that enables you to create and share your own website, as well as develop and host your PHP applications.
You can change the website’s look and how it works by editing the code right in your web browser.
It’s easy to use and doesn’t require any setup
The code editor is packed with features to help you achieve more:
- Templates: Start from scratch or use a template
- Cloud-based: no installations required. You only need your browser
- Terminal & Log: debug and troubleshoot your code easily
- File Navigator: switch between files inside the code editor
- And much more!
Learn Faster
Practice is key to mastering coding, and the best way to put your PHP knowledge into practice is by getting practical with code.
Use W3Schools Spaces to build, test and deploy code.
The code editor lets you write and practice different types of computer languages. It includes PHP, but you can use it for other languages too.
New languages are added all the time:
If you don’t know PHP, we suggest that you read our PHP Tutorial from scratch.
Easy Package Management
Get an overview of your packages and easily add or delete frameworks and libraries. Then, with just one click, you can make changes to your packages without manual installation.
Build Powerful Websites
You can use the code editor in W3School Spaces to build frontend or full-stack websites from scratch.
Or you can use the 60+ templates available and save time:
Create your Spaces account today and explore them all!
Share Your Website With The World
Host and publish your websites in no time with W3School Spaces.
W3Schools subdomain and SSL certificate are included for free with W3School Spaces. An SSL certificate makes your website safe and secure. It also helps people trust your website and makes it easier to find it online.
Want a custom domain for your website?
You can buy a domain or transfer an existing one and connect it to your space.
How Does It Work?
Get started in a few clicks with W3School Spaces.