Jump to: navigation, search

PHP is programming language designed to make website and to write robots.

In the case of macintosh, PHP comes together with the XCode package. As other programs, it can be localized with command which php. Command man php characterises PHP it as follows:
is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.
The same definition is suggested at the site [1].


PHP coode

The PHP code begins with word $\rm <?php $

The code ends with word $\rm ?\!>$

Between these two words, the PHP commands are placed. These commands are executed in a way similar to that in other languages, while the php program or the web browser finds the code.

Wikipedia suggests [2] the following example of code embedded to HTML

<!DOCTYPE html>
<meta charset=utf-8>
<title>PHP Test</title>
echo 'Hello World';

The specification of charset is not essential, but helps to deal with case, if any non–ascii characters appear in the text echoed: for some languages, even in century 21, several systems of encoding are used; a text, prepared at one computer, looks as abracadabra, while viewed at another computer. In century 20, In some countries, the mafia at the top of government blocked elaboration of the united encoding for national language in computers; this was important part of prohibition of non-authorized distribution of information [3]. The great efforts of programmers and users were required to mitigate this problem. The specification charset=utf-8 serves as reminder, that one should always use Unicode for important documents.

Executing from the command line

PHP code stored in file $a$.php can be executed from the command line with command

php $a$.php

where $a$ denotes name of file.


Names of variables begin with the $\$$ sign. In TORI, the dollar sign switches the math style for typing formulas. To load a PHP program to TORI, the options

$\rm < nomathjax >$


$\rm <\! poem \! >$

can be used.

As in Mathematica, In PHP, types of variables have no need to be especially declared. The type of variable is assigned according to the type of expression in th eright hand side of the assignment operator.


The syntax of PHP is similar to that of C++; many C++ expressions can be used in PHP as is.

However, in order to provide new line, instead of just "\n", in PHP one should type "\r\n".


  1. What is PHP? try the introductory tutorial After that, check out the online manual
  3. In the USSR, the Soviet veterans had prohibited the centralized rusification of computers; and many encodings are used for the Russian characters. Since that, English becomes more robust, than Russian. The recovery of the Russian culture after the anti-Russian activity of the Soviet veterans may take long time, if at all. Use of utf-8 is important for such a recovery.


Programming language, C++