Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
How was this language originally conceived?template engine. Not functional and not OO.
I would answer like this: "What does this have to do with it?! Does the performance and architecture of the future code depend on this information? - No."
Well, here's a quote:
Thus, by choosing PHP, you get the freedom to choose the operating system and web server. Moreover, you have a choice between using procedural or object-oriented programming (OOP), or a combination of both.He says that he is universal and is not divided.
PHP is any language, but definitely not a functional one.
Z.Y.
It is a pity that it is impossible to write here in which particular office this was asked.
UPD
Maybe the question meant not "functional", but "procedural"? You won't believe how many people confuse procedural and functional languages.
If so, then PHP is both. More specifically, I think the correct answer in your case would be that PHP is a multi-paradigm language.
I can only give you my answer to the interviewer:
None. A distinctive feature of PHP is that it was not conceived as a programming language. This is even reflected in the name - PHP (recursive acronym for PHP: Hypertext Preprocessor).
At the PHP3 stage, it was already a full-fledged procedural programming language , where it was no longer possible to write logic in C.
In PHP4, "classes" were introduced into the language to give a state isolation mechanism. It still could not be called OOP simply because ... these are not objects but classes. There is no encapsulation, only ad-hoc polymorphism (which all languages with a dynamic type system have) and limited subtype polymorphism. Well, class inheritance is already recognized as an unnecessary thing in the context of OOP.
Interfaces were finally introduced in PHP5, and it was now possible to do normal polymorphism. Access modifiers have been introduced, etc. but the language is still procedural by and large (and that's fine, since all existing OO languages are procedural).
PHP5.3 introduced anonymous functions. but without lexical scopes, without higher-order functions, doing "pure functionality" simply won't work. In any case, it will be inconvenient.
From this we conclude - PHP today is a procedural programming language that has enough opportunities to practice all the main programming paradigms just with varying degrees of convenience.
PHP was originally conceived as a scripting language - a procedural programming language with dynamic typing and the ability to enter a couple of lines without shaping the body. So it remains to this day, interspersed with OO. There is some functionality, of course, but this does not make PHP - like Java or C ++, by the way - a real functional language.
I thought it all depends on the task. There is both OOP and functional application. That's when the question "how did he think?" and put me in a rut.
Thanks for answers.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question