Lecture
— How did you start learning programming?
— C, HTML, CSS, JavaScript, PHP, frameworks
— Preferred development environment?
— PhpStorm — highlighting, autocomplete, version control, database.
Notepad++ — syntax highlighting, snippets, macros.
— Why did you choose PHP?
— PHP, because when I started web development, I was surprised to learn that hosting providers typically don't allow compiling C programs on their servers. The alternatives were PHP and Perl. I looked at the source code for a couple of guest projects using both, and chose PHP because of its similarity to C in syntax and, as a result, the likely reduction in learning time.
– What third-party libraries did you use?
– Pear, GeoIP
– Experience with various frameworks?
– Zend Framework, Yii, Laravel, CakePHP, CodeIgniter
— What's new in PHP 5.3?
— Namespaces, closures, class constants
— What's new in PHP 5.4?
— Traits, shorthand for arrays
— What's new in PHP 5.6?
— Expressions in constants, unfixed parameters in functions, **
— What's new in PHP 7?
— Type declarations in function parameters, return value declarations in functions, ??, <=>, arrays in constants, anonymous classes
– Data types in PHP?
– Scalar data types include:
* integer,
* float, * double,
* boolean,
* string,
* and the special NULL type.
Non-scalar types include:
* resource,
* array,
* and object.
– Name from memory the functions for working with arrays, strings
void echo ( string arg1 [, string argn...])
string convert_cyr_string ( string str, string from, string to)
array explode ( string separator, string string [, int limit])
string htmlspecialchars ( string string [, int quote_style [, string charset]])
string implode ( string glue, array pieces)
string md5 ( string str [, bool raw_output])
string nl2br ( string string)
void printf ( string format [, mixed args])
mixed str_replace ( mixed search, mixed replace, mixed subject [, int &count])
string str_shuffle ( string str)
string strip_tags ( string str [, string allowable_tags])
int strlen ( string str)
int strpos ( string haystack, string needle [, int offset])
string strstr ( string haystack, string needle)
string strtolower ( string str)
string strtoupper ( string string)
string trim ( string str [, string charlist])
string ucfirst ( string str)
array array_merge ( array array_1, array array_2 [, array ...])
array array_unique ( array array)
array array ( [mixed ...])
int count ( mixed var [, int mode])
bool in_array ( mixed needle, array haystack [, bool strict])
void list ( mixed ...)
void shuffle ( array array)
— Swap the values of variables A and B without using a third variable
PHP
|
1 2 3 4 5 6 |
<? $a += $b; $b = $a - $b; $a -= $b;
//list($b, $a) = array($a, $b); |
— The difference between echo and print
— echo is a construct, print is a function
– What is serialization?
– Representation of data (variables, arrays, objects) for their transmission (storage)
— How to store passwords (in cleartext or hash)
— password_hash, password_verify (php 5.5+)
— What distinguishes good code from bad code
? — Good code follows code conventions, is commented, is safe, is structured, and handles errors.
OOP – abstraction, inheritance, encapsulation, and polymorphism
. Encapsulation is when variables are contained within an object and accessed through methods.
Polymorphism is the ability to define different methods with the same name. This is discussed on the website https://intellect.icu. For int and float parameters, PHP does not have normal polymorphism.
Inheritance is the copying of properties and methods from base classes, with the ability to override and extend them.
Abstraction is the creation of properties, methods, and classes that must be overridden by their heirs before being used.
— What design patterns do you know? Tell me the key to each one?
— What is MVC? What role does each component play?
— Model-view-controller (MVC) is a software architecture in which the application's data model, user interface, and control logic are separated into three distinct components, so that modification of one component has minimal impact on the others. The MVC pattern allows for the separation of data, presentation, and user interaction processing into three distinct components.
— How does code review help? — When someone looks at your code?
— Syntax errors
— Conventions
— Security
— Utilities
How long does it take to develop a guestbook?
Visitors:
* viewing the guestbook as a feed of 20 posts per page;
* registration.
Users:
* authorization,
* password recovery,
* adding posts to the guestbook.
Administrator:
* editing posts,
* adding replies to posts (1 post - 1 reply).
- 4-8 hours
— How does the admin respond to posts (in a separate table or in the same one as the posts?)
— in a separate table — comments
Comments
To leave a comment
Running server side scripts using PHP as an example (LAMP)
Terms: Running server side scripts using PHP as an example (LAMP)