PHP
You can read this for more info about the topic |
|---|

PHP is a general-purpose scripting language especially suited to web development. Its syntax is similar to Java and Perl and was originally created by Canadian programmer Rasmus Lerdorf in 1993 as a set of Common Gateway Interface (CGI) binaries written in C for tracking visits to his online resume. Over time, PHP evolved into a powerful server-side scripting language that now powers millions of websites, such as soyjak.party and even this very wiki. Even though it is sometimes seen as “old” or “messy” compared to newer frameworks and languages, PHP still sees heavy use so don’t believe what the angry Chud programmers on Twitter or Reddit say. In fact, PHP still gets plenty of feature updates making it still just as good with other competitive server-side languages. Its ease of deployment, gigantic ecosystem of frameworks and libraries, and the sheer number of legacy PHP sites still online ensure that PHP will be around for a long time to come.
Notable features[edit | edit source]

PHP is best known for:
- PHP code runs on the server and generates HTML to be sent to the client’s browser. This makes it ideal for building websites, content management systems, and web applications.
- PHP has an massive library of frameworks, plugins, and tools thanks to it's wide adoption and ecosystem from platforms such as ACK!press.
- PHP can be mixed directly with HTML code, making it beginner-friendly and great for creating templates.
- PHP works seamlessly with SQL systems, such as MySQL, PostgreSQL, SQLite, and other databases to create dynamic, data-driven websites.
- PHP runs on Windows, Linux, macOS, and most web servers, making it highly versatile.
- By using the
declare(strict_types=1)directive, PHP can enforce strict types and type information.
How does PHP work?[edit | edit source]
At the heart of PHP is the Zend Engine, a open-source compiler and runtime environment for the PHP scripting language. Whenever a PHP file is requested, the following happens behind the scenes:
- The PHP interpreter lexes the PHP code, then converts it into an internal representation called an abstract syntax tree.
- The Zend Engine then compiles the syntax tree into low-level opcodes, which are a simplified set of instructions optimized for execution.
- The Zend Engine executes the opcodes line by line, handling function calls, database queries, file I/O, and any other server-side logic.
- The result of the script (usually HTML, JSON, or another format) is sent back to the web server, which delivers it to the client’s browser.
Scripts[edit | edit source]
|
CSS switcher css.php
include this in the <?php
if (!isset($_COOKIE['theme'])) {
setcookie("theme", "yotsuba", time() + (86400 * 399), "/");
} else {
$theme = $_COOKIE['theme'];
}
if ($theme == "light") {
echo("<link href='/soychiver/base.css' rel='stylesheet'>");
} else if ($theme == "dark") {
echo("<link href='/soychiver/base.css' rel='stylesheet'>");
echo("<link href='/soychiver/dark.css' rel='stylesheet'>");
}
theme.php This is where the user chooses their theme. <?php
function setTheme($theme) {
setcookie("theme", $theme, time() + (86400 * 399), "/");
header("Location: index.php");
exit;
}
$themearray = ['light', 'dark'];
if (isset($_GET['a']) && in_array($_GET['a'], $themearray)) {
setTheme($_GET['a']);
} else {
die("Available themes: <a href='?a=light'>Light</a> <a href='?a=dark'>Dark</a>");
}
|
|
PHP is part of a series on Computer Science. |
|
|---|---|
| Languages | Low Level Assembly • C • C++ • C# • Holy C • Rust High Level Java • Go • PHP • Python • SQL Bash • JavaScript • PowerShell • ActionScript • Scratch • Ruby |
| Software | Imageboards Quotechan • Vichan • Yotsuba • OpenYotsuba OSes Windows • Linux • Android • TempleOS |
| More | SoyGNU • CGI • DDoS • Vibe coding • Game development • Piracy • Regex • Doxing • Microsoft • Apple • Google • Datamining • WebP • Artificial soyduel • Ratio dueling • Customization • Ricing • FSL • Windows debloating |

