Hello friends! As they used to say in Rus': “Every merchant praises his goods” and no matter how many different articles you read about SSDs, you are unlikely to come across the same opinion. Someone read something and decided to buy it solid state drive Samsung, Toshiba, and others decided to purchase SSD OCZ Vertex or Kingston at all costs.

About a year and a half ago, my friends and I firmly decided to buy an SSD solid-state drive, but everyone has them, but we don’t. My friends asked me to test various SSDs and choose the best one.

Solid-state drives are not sold very well, so sellers of computer goods do not carry a lot of them, so as not to lie as dead weight in the warehouse. We also do the same, which is why I had at my disposal the best-selling SSDs at that time. The most inexpensive of the entire company turned out to be the Silicon Power V70 SSD, the test of which I left for later.

I wasn’t particularly sophisticated in my tests; I installed an operating system on each SSD, then compared the SSD and a regular HDD in the CrystalDiskMark and AS SSD Benchmark test programs. I didn’t have to prove to anyone that an SSD is better than a regular HDD. Windows installed on an SSD loaded in 4 seconds; the test programs CrystalDiskMark and AS SSD Benchmark showed the complete superiority of the SSD over a regular HDD by 3-4 and even 5 times.

I carried out all the tests on the sales floor and the information was available to customers, in short, all the test SSDs were disassembled, besides, that day was good for sales and there wasn’t even a single SSD left on the display case, well, I think I was left without a solid-state drive! And then I remembered about SSD Silicon Power - V70. In principle, I knew this good manufacturer from Taiwan, but I still wanted something else, for example Crucial or Plextor!

I also decided to test it at the end of the working day and after the tests I was a little surprised, the V70 turned out to be a great solid-state drive, in no way inferior to other SSDs I tested and sold that day. And the SiSoftware Sandra program generally awarded him first place.

Over the course of a year, it didn’t work for me anywhere: both on a laptop and on different desktops system units and instead of a flash drive, I carried it in my pocket and dropped it on the floor, but nothing, it still works fine.

Well, okay, enough chatter, I’ll move on to the most important part of the article, the answers to your questions about the solid-state drive, and at the end of the article I’ll give some tests that prove that an SSD for installing an operating system is just what the doctor ordered.

ALL your questions regarding SSDs.

1. What is it like internal organization SSD? Which NAND flash memory should I buy an SSD based on: SLC, MLC or TLC?

2. Which SSD manufacturer should you prefer?

3. Is Solid State Life Real? SSD drive very limited? After how many years of use will my SSD fail?

4. Is the user at risk of losing all recorded data if the resource of the memory chips is exceeded?

5. To extend the life of the SSD, is it worth disabling hibernation, paging file, recovery, disk indexing service, disk defragmentation, Prefetch technology, transferring the browser cache and temporary files directory to another HDD and so on ?

6. To what extent faster SSD ordinary hard drive?

Comparing different SSDs in terms of performance

It is important to know not only the average sequential read and write speed on an SSD, but also what is hushed up by all SSD manufacturers - the random write speed in blocks of 512 kB and 4 kB! Disk activity for most users occurs mainly in such areas!

When comparing SSD various manufacturers in the AS SSD Benchmark program we can see the following result, for example:

My SSD Silicon Power V70 showed:

Sequential read and write speed 431 MB/s (read), 124 MB/s (write)

Reading and writing speed in 4 KB blocks, resulting in 16 MB/s (read), 61 MB/s (write)

SSD from another manufacturer. As you can see, there is a high (higher than my SSD) sequential read and write speed of 484 MB/s (read), 299 MB/s (write), but there is a drop in reading/writing in 4 KB blocks, namely 17 MB/s ( read), 53 MB/s (write). This means this SSD not faster than mine, although the box of this SSD may show the numbers 500 MB/s.

SSD test in SiSoftware Sandra program

My SSD ranked first among similar models

Last update: 10/20/2017

Today, PHP is the most common web programming language. The vast majority of sites and web services on the Internet are written with using PHP. According to some estimates, PHP is used on more than 80% of websites, including services such as facebook.com, vk.com, baidu.com and others. And such popularity is not surprising. The simplicity of the language allows you to quickly and easily create websites and portals of varying complexity.

PHP was created in 1994 by Danish programmer Rasmus Lerdorf and was originally a set of scripts in another language, Perl. Later, this set of scripts was rewritten into an interpreter in the C language. And since its inception, PHP (short for PHP: Hypertext Preprocessor) has been a convenient set of tools for simplifying the creation of websites and web applications.

What benefits does PHP provide?

    All the most common operating systems (Windows, MacOS, Linux) have their own versions of PHP development packages, which means that you can create websites on any of these operating systems.

    PHP can work in conjunction with various web servers: Apache, Nginx, IIS

    Simplicity and ease of learning. As a rule, already having a little experience in programming in PHP, you can create simple websites

    PHP is similar to the C language, so knowing C or one of the languages ​​with C-like syntax will make it easier to master PHP

    PHP supports many database systems (MySQL, MSSQL, Oracle, Postgre, MongoDB and others)

    The prevalence of hosting services and their low cost. Since, as a rule, hosting companies host PHP websites on Apache or Nginx web servers, which run on one of the Linux operating systems. Both web servers and operating systems on Linux based are free, which reduces the overall cost of using hosting

    Constant development. PHP continues to develop, new versions are being released that carry new functions, adapting the programming language to new challenges. And, as a rule, switching to a new version is not difficult.

    As of now (October 2017), the current stable version of PHP is PHP 7.1.

Now let's create our first small website in PHP. But before creating it, we need to download and install everything necessary tools for website development.

PHP (English PHP: Hypertext Preprocessor - "PHP: Hypertext Preprocessor", English Personal Home Page Tools (obsolete) - "Tools for creating personal web pages") - a programming language created for generating HTML pages on a web server and working with databases. Currently supported by the vast majority of hosting providers. Included in LAMP - a common set for creating websites (Linux, Apache, MySQL, PHP (Python or Perl)).

The PHP development team consists of many people volunteering to work on the PHP core and extensions and related projects such as PEAR or language documentation

In the field of web programming, PHP is one of the most popular scripting languages ​​(along with JSP, Perl and the languages ​​used in ASP.NET) due to its simplicity, speed of execution, rich functionality and distribution of source codes based on the PHP license. PHP is distinguished by the presence of a core and plug-ins, “extensions”: for working with databases, sockets, dynamic graphics, cryptographic libraries, documents PDF format etc. Anyone can develop their own extension and connect it. There are hundreds of extensions, but the standard package includes only a few dozen that have proven themselves. The PHP interpreter connects to a web server either through a module created specifically for that server (for example, Apache or IIS) or as a CGI application.

In addition, it can be used to solve administrative tasks in GNU/Linux operating systems, Microsoft Windows, Mac OS X and other OS versions. However, it did not gain popularity in this capacity, giving the palm to Perl, Python and VBScript.

PHP is currently used by hundreds of thousands of developers. About 20 million sites report working with PHP, which is more than a fifth of Internet domains.

The name PHP is a recursive acronym meaning “PHP: Hypertext Preprocessor” (previously the acronym stood for “Personal Home Page Tools”). PHP was originally created as an add-on to Perl to make web page development easier.

In 1994, Danish programmer (now living in Canada) Rasmus Lerdorf wrote a set of Perl/CGI scripts to display and count visitors to his online resume, processing HTML document templates. Lerdorf called the set Personal Home Page. Soon, the functionality and speed of Perl, a script interpreter, was no longer enough, and Lerdorff wrote a new PHP/FI template interpreter (Personal Home Page / Forms Interpreter) in C. PHP/FI included basic functionality of today's PHP: design of variables in the Perl style ($variable_name for displaying the value), automatic processing of forms and embedding in HTML text, etc. The newborn language differed from its ancestor in a simpler and more limited syntax.

In 1997, after long beta testing, the second version of the handler, written in C, PHP/FI 2.0, was released. It was used by about 1% (approximately 50 thousand) of all Internet domains in the world.

PHP 3.0 was the first version that resembled PHP as we know it today. In 1997, two Israeli programmers, Andi Gutmans and Zeev Suraski, developers from the Israel Institute of Technology located in Haifa, Israel, rewrote the code from scratch: PHP/FI 2.0 was considered unsuitable for developing an electronic application. commerce they were working on at the time. To work together on PHP 3.0 with the help of the PHP/FI 2.0 developer base, Andy, Rasmus and Ziv decided to team up and declare PHP 3.0 the official successor to PHP/FI, while PHP/FI development was almost completely stopped.

One of the strongest PHP sides 3.0 it was possible to expand the kernel. Subsequently, the interface for writing extensions attracted many third-party developers to PHP working on their modules, which gave PHP the opportunity to work with a huge number of databases, protocols, and support a large number of APIs. In fact, this was the main key to success, but it is worth adding that an important step was the development of a new, much more powerful and complete syntax with OOP support.

Absolutely new language programming received a new name. The developers abandoned the personal use addendum that was included in the PHP/FI acronym. The language was simply called PHP.

By the end of 1998, PHP was used by tens of thousands of users. Hundreds of thousands of websites report that they operate using this language. At that time, PHP 3.0 was installed on approximately 10% of the Internet's web servers.

PHP 3.0 was officially released in June 1998 after 9 months of public testing.

PHP 4.0. By the winter of 1998, almost immediately after the official release of PHP 3.0, Andy Gutmans and Ziv Surasky began reworking the PHP core. The objectives included increasing productivity complex applications and improving the modularity of the PHP code base. Extensions gave PHP 3.0 the ability to successfully work with a variety of databases and support a large number of different APIs and protocols, but PHP 3.0 did not have high-quality module support and applications performed inefficiently.

The new engine, called Zend Engine (after the names of the creators, Ziv and Andy, also founders of Zend Technologies), successfully coped with the tasks and was first introduced in mid-1999. PHP 4.0, based on this engine and bringing with it a set of additional features, was officially released in May 2000, almost two years after the release of its predecessor PHP 3.0. In addition to performance improvements, PHP 4.0 had several other key innovations such as session support, output buffering, more safe ways processing user input and several new language constructs.

PHP 4 updates were scheduled to stop being released at the end of 2007. However, until August 8, 2008, critical security updates were released. As of August 9, 2008, all support for PHP 4.x was discontinued.

PHP 5.0. Fifth PHP version was released by the developers on July 13, 2004. The changes include an update to the Zend core (Zend Engine 2), which significantly increases the efficiency of the interpreter. Support for XML markup language has been introduced. The OOP functions have been completely redesigned to be very similar to the model used in Java. In particular, the destructor, public, private and protected members and methods, final members and methods, interfaces and object cloning are introduced. Innovations, however, were made with the expectation of maintaining the greatest compatibility with code on previous versions language. On this moment The stable and most popular version is PHP 5.xx.

  • On August 1, 2008, the first alpha version of PHP 5.3.0 was announced, which contains a number of changes and additions:
    • - Namespace
    • - Late static binding and special method __callStatic()
    • - Anonymous functions
    • - Addition of the intl, phar (phar is scheduled for some more work a head of alpha2), fileinfo and sqlite3 extensions
    • - Optional cyclic garbage collection
    • - Optional support for the MySQLnd replacement driver for libmysql
    • - Cancellation of support for operating system versions prior to Windows 2000 (Windows 98, NT4, etc.)
    • - New syntactic constructs such as NOWDOC, limited GOTO, short form of ternary operator "?:"

PHP 6.0. The sixth version of PHP has been under development since October 2006. It has already made many innovations, such as exclusion from the kernel regular expressions POSIX and “long” superglobal arrays, removing the safe_mode, php_magic_quotes and register_globals directives from the php.ini configuration file. Also, a lot of attention is paid to Unicode support. You can download the current version of the development code for GNU/Linux/BSD and compiled versions for Microsoft Windows on the PHP Snapshots website.

PHP syntax. The PHP syntax is similar to the C language syntax. Some elements such as associative arrays and the foreach loop, borrowed from Perl.

For the program to work, it is not necessary to describe any variables, modules used, etc. Any program can start directly with a PHP statement.

PHP executes code inside delimiters such as . Everything outside the constraints is output unchanged. Basically, it is used to insert PHP code into an HTML document.

In addition to limiters, it is possible to use additional options, such as and. In addition, up to version 6.0, the use of ASP programming language delimiters is allowed (the and constructs can be disabled in the php.ini configuration file).

Variable names begin with the $ symbol; the variable type does not need to be declared. Unlike function and class names, variable names are case sensitive. Variables are processed in lines enclosed in double quotes, and heredoc lines (lines created using the $b operator; // Access to field a of the object, because $b = "a"

$obj->$c(); // Call the object's function_name() method

Superglobal arrays. Superglobal arrays in PHP are predefined arrays. Most of these arrays contain user request input data (GET request parameters, form fields when sending POST method, cookies, etc.).

All superglobal arrays except $GLOBALS and $_REQUEST have obsolete counterparts with long names, which are available up to the fifth version of PHP (they are planned to be eliminated in the sixth version). Thus, the calls $_GET["year"] and $HTTP_GET_VARS["year"] are identical.

An array of all global variables (including user ones).

$_SERVER (obsolete equivalent - $HTTP_SERVER_VARS)

Contains environment variables, which operating system transmits to the server.

$_ENV (set $HTTP_ENV_VARS)

Current Environment Variables(English: Environment variables). Their set is specific to the platform on which the script is executed.

$_GET (set $HTTP_GET_VARS)

Contains GET request parameters passed in the URI after the question mark "?".

$_POST (set $HTTP_POST_VARS)

An associative array of HTML form field values ​​when sent using the POST method. Element indices correspond to the value of the name attribute of the HTML form controls.

$_FILES (set $HTTP_POST_FILES)

An associative array with information about files sent using the POST method. Each element has an index identical to the value of the “name” attribute in the form and, in turn, is also an array with the following elements:

["name"] is the original name of the file on the user's computer.

["type"] -- MIME file type specified by the user agent. PHP does not check it and therefore there is no guarantee that the specified type is correct.

["size"] -- file size in bytes.

["tmp_name"] -- full path to the file in the temporary folder. The file must be moved from there using the move_uploaded_file function. PHP automatically deletes downloaded files from the temporary folder.

$_COOKIE (set $HTTP_COOKIE_VARS)

An associative array with cookie values ​​passed by the user agent.

Contains elements from the $_GET, $_POST, $_COOKIE arrays. Since PHP 4.1, includes $_FILES.

$_SESSION (set $HTTP_SESSION_VARS)

Contains session data.

Object-oriented programming. PHP supports extensive object-oriented capabilities, full support for which was introduced in the fifth version of the language.

A class in PHP is declared using keyword class. Methods and fields of a class can be public (public, by default), protected (protected) and hidden (private). PHP supports all three main OOP mechanisms - encapsulation, polymorphism and inheritance (the parent class is specified using the extends keyword after the class name). Interfaces are supported (matched using implements). Declaration of final, abstract methods and classes is allowed. Multiple class inheritance is not supported, but a class can implement multiple interfaces. To access methods of the parent class, the parent keyword is used.

Classes in PHP have a number of special methods(English Magic methods), starting with two underscores. Particularly worth noting is the constructor (__construct(), in earlier versions the constructor was a method of the same name as the class) and destructor (__destruct()), as well as the methods of reading (__get()) and writing (__set()), folding (__sleep() ) and deployment (__wake()), cloning (__clone()), etc. These methods are quite flexible tools: by overriding them, you can easily achieve a significant change in the behavior of the object.

Instances of a class are created using the new keyword, and the fields and methods of an object are accessed using the -> symbols. To access members of a class from its methods, use the $this variable.

1 year ago | 98.5K

Hello everyone, my name is Sergey Nikonov, for those who don’t know me, I’ll tell you a little about myself. I have more than 10 years of experience in developing websites and web applications, and in this video I will try to answer one of the most frequently asked questions - Which programming language should I learn first?

Watch the video The first programming language. Which one to choose in 2018?

The programming language itself is simply a tool through which this or that goal is achieved, and all object-oriented programming languages ​​have common properties, such as variables, arrays, functions, methods, classes, interfaces and other properties.

And when you learn to use these properties at least at an intermediate level in one programming language, you can very easily get used to any other programming language.

But I also want to emphasize that do not try to learn all programming languages ​​at once, like some students, they tried a little, for example, writing in Java, after a couple of days they switched to Python, then to . As a result, with this approach, they did not master a single language, since there is a lot of information that needs to be learned, students have a mess in their heads, and at the same time they lose motivation to study programming at all.

Therefore, until you have learned one programming language at least at an intermediate level, do not switch to another.

Which programming language should you choose as your first?

I recommend choosing PHP, as this language is very simple, has a huge community, and also a large number of vacancies around the world if you want to learn programming in order to change your current profession.

Someone may object, say that PHP is slow, bad code is written in it, etc. but one of the clearest examples is the Facebook website. It is written in PHP and the Facebook site is ranked 2nd in terms of traffic in the world, among millions of websites. By the way, social network VKontakte, also written in PHP.

As for bad code in PHP, this is possible, since the language itself gives a lot of freedom of action and if PHP is not learned correctly, your code will be confusing and the site will be slow. I will tell you how to properly learn PHP on your own and in what order in one of the following videos.

Quite often I get asked the question:

First of all, you need to understand that HTML is a markup language, not a programming language, and refers to the layout of html pages. With the help of , you explain to the browser what your page should look like, what size and color the blocks on the site should be.

How to start programming in PHP?

Programming in PHP is very easy and all you need is

PHP is a widely used scripting language general purpose open source.

Simply put, PHP is a programming language specifically designed for writing web applications (scripts) that run on a web server.

The abbreviation PHP stands for “Hypertext Preprocessor”. The language syntax comes from C, Java and Perl. PHP is quite easy to learn. PHP has the advantage of providing web developers with the ability to quick creation dynamically generated web pages.

PHP Features

There are three main areas where PHP is used.

Creating scripts to be executed on the server side. PHP is most widely used this way. All you need is a PHP parser (in the form of a CGI program or a server module), a web server and a browser. To view the results of executing PHP scripts in a browser, you need a running web server and PHP installed.

Creating scripts to run in command line. You can create a PHP script that can run independently of the web server and browser. All you need is a PHP parser. This way using PHP ideal for scripts that need to be executed regularly, for example using cron (on *nix or Linux platforms) or using the Task Scheduler on Windows platforms. These scripts can also be used in simple word processing tasks. Additional Information is here.

Creating GUI applications that run on the client side. Perhaps PHP is not the best best language to create such applications, but if PHP is well known and you want to use some of its capabilities in your client applications, then you can use PHP-GTK to create such applications. You can create cross-platform applications in a similar way. PHP-GTK is a PHP extension and is not included with the PHP distribution.

History of PHP

The origins of PHP lie in an old product called PHP/FI. PHP/FI was created by Rasmus Lerdorf in 1995 and was a set of Perl scripts to keep statistics of visits to his resume.

Rasmus Lerdorf (born November 22, 1968) is a Danish programmer (now living in Canada) who wrote a set of Perl/CGI scripts in 1994.

The development of the web was just beginning, there were no special tools for solving such problems, and a stream of messages with questions poured in to the author. Lerdorf began giving away his tools, called “Personal Homepages Tools,” for free. Very soon, more functionality was needed and Rasmus wrote a new, much more extensive version in C, working with databases and allowing users to develop simple web applications. Rasmus Lerdorf decided to release the PHP/FI source code for public viewing, bug fixes and additions.

PHP/FI (Personal Home Page / Forms Interpreter - Personal Homepage/Forms Interpreter) included the basic functionality of today's PHP. It had Perl-style variables, automatic form interpretation, and the ability to be embedded in html code. The actual syntax of the language had much in common with Perl, although it was much simpler and more limited.

PHP/FI 2.0 was released in 1997. The second version of the C implementation identified a group of users: several thousand people around the world, with approximately 50,000 domains, which represented about 1% of the total number of Internet domains. Despite the fact that several people were already involved in development, PHP/FI 2.0 was still a large one-man project.

PHP/FI 2.0 was not officially released until November 1997, after spending most of its life in beta versions. Shortly after its release, it was replaced by alpha versions of PHP 3.0.

PHP 3.0 was the first version that resembled PHP as we know it today. In 1997, Andi Gutmans and Zeev Suraski rewrote the code from the beginning because the developers found PHP/FI 2.0 unsuitable for developing the e-commerce application they were working on for a University project. To work together on PHP 3.0 with the help of the PHP/FI 2.0 developer base, Andy, Rasmus and Ziv decided to team up and declare PHP 3.0 the official successor to PHP/FI, while PHP/FI development was almost completely stopped.

By the end of 1998, PHP was being used by tens of thousands of users. Hundreds of thousands of websites report that they operate using the language. At that time, PHP 3.0 was installed on approximately 10% of the Internet's servers!

PHP 3.0 was officially released in June 1998 after 9 months of public testing.

By the winter of 1998, almost immediately after the official release of PHP 3.0, Andy Gutmans and Ziv Surasky began reworking the PHP core. The objectives included increasing the performance of complex applications and improving the modularity of the PHP code base. Extensions gave PHP 3.0 the ability to successfully work with a set of databases and support a large number of different APIs and protocols, but PHP 3.0 did not have high-quality module support and applications did not work efficiently.

The new engine, called "Zend Engine" (www.zend.com) (from the names of the creators: Zeev and Andi), successfully coped with the tasks and was first introduced in mid-1999. PHP 4.0, based on this engine and bringing with it a set of additional features, was officially released in May 2000, almost two years after the release of its predecessor PHP 3.0. In addition to performance improvements, PHP 4.0 had several other key innovations, such as session support, output buffering, safer ways to handle user input, and several new language constructs.

The fifth version of PHP was released by the developers on July 13, 2004. The changes include an update to the Zend core (Zend Engine 2), which significantly increases the efficiency of the interpreter. Support for XML markup language has been introduced. The OOP functions have been completely redesigned to be very similar to the model used in Java. In particular, the destructor, public, private and protected members and methods, final members and methods, interfaces and object cloning are introduced. Subsequent versions also introduced namespaces, closures, and a whole series of fairly serious changes, quantitatively and qualitatively comparable to those that appeared during the transition to PHP 5.0.

The sixth version of PHP 6.0 has been in development since October 2006. Many innovations have been made, such as the exclusion of POSIX regular expressions and “long” superglobals from the core, and the removal of the safe_mode, magic_quotes_gpc and register_globals directives from the php.ini configuration file. One of the main innovations was supposed to be Unicode support. However, in March 2010, the development of PHP6 was considered futile due to difficulties with Unicode support. Source PHP6 was moved to a branch, and version 5.4 became the main development line.

In 2014, a vote was held, according to which the next version was named PHP 7. Exit new version was planned for mid-October 2015. In March 2015, Zend presented an infographic that describes the main innovations of PHP 7.

PHP architecture

PHP is an interpreter with a built-in translation block that optimizes the flow of interpretation.

Using an interpreter (and therefore PHP) has its undeniable advantages:

1. There is no need to worry about freeing allocated memory, there is no need to close files when you finish working with them - the interpreter will do all the routine work, since the program is executed under its watchful control;

2. No need to think about variable types, and no need to declare a variable before its first use;

3. Debugging programs and detecting errors is greatly simplified - the interpreter has complete control over this process;

4. In the context of web applications, the interpreter also has a very important advantage - there is no danger of the server “freezing” if the program does not work correctly.

PHP syntax

The PHP syntax is similar to the C language syntax. Some elements, such as associative arrays and the foreach loop, are borrowed from Perl.

For the program to work, it is not necessary to describe any variables, modules used, etc. Any program can begin directly with a PHP statement.

The simplest PHP program looks like this:

In addition to limiters, it is possible to use additional options, such as and.

Variables and data types

PHP is a programming language with dynamic typing, which does not require specifying the type when declaring variables, as well as the declaration of variables itself. Conversions between scalar types are often done implicitly without additional effort (however, PHP provides ample opportunities for explicit type conversions).

Scalar data types include:

whole type (integer),
real data type (float, double),
logical type (boolean),
string type (string),
and the special type NULL.

Non-scalar types include:

"resource"
array (array),
object (object),

Pseudotypes include:

mixed any type
number number (integer or float)
callback (string or anonymous function)
void no parameters

The range of integers in PHP depends on the platform (usually the range of 32-bit signed integers, that is, −2,147,483,648 to 2,147,483,647). Numbers can be specified in decimal, octal and hexadecimal number systems.

Range real numbers(double) also depends on the platform (for a 32-bit architecture, the range allows you to operate with numbers from ±1.7×10−308 to ±1.7×10+308).

PHP provides developers with a boolean type that can only accept two TRUE values(“true”) and FALSE (“false”). When converted to a boolean type, the number 0, the empty string, the zero in the string "0", NULL, and the empty array are considered FALSE. All other values ​​are automatically converted to TRUE.

A string can be defined in three different ways.

  • single quotes
  • double quotes
  • heredoc syntax

The simplest way to define a string is to enclose it in single quotes (the " character). To use a single quote within a string, it must be preceded by a backslash (\), i.e., escaped. If the backslash must come before the single quote, or be at the end of the line, you need to duplicate it.There is no need to escape the backslash itself.

If the string is enclosed in double quotes ("), PHP recognizes more escape sequences for special characters:

heredoc definition (PHP):

Variables inside heredoc are interpreted. If you want to specify the end of a name, enclose the variable name in curly braces.

$s =