4

I am familiar with how PHP functions are mapped to functions in C in the C code beneath PHP. I know in C what a function means and what a MACRO() means.
I do not understand what is a language construct, like echo, in PHP means.

OZ_
  • 12,492
  • 7
  • 50
  • 68
Itay Moav -Malimovka
  • 52,579
  • 61
  • 190
  • 278
  • I think it is basically a fancy name for an operator. – alex Jul 09 '11 at 03:38
  • but, operator **is** a function, just different syntax. – Itay Moav -Malimovka Jul 09 '11 at 03:40
  • 2
    @Itay Moav: php devs just called some group of tokens "language construct". Just accept it. – zerkms Jul 09 '11 at 03:41
  • @zerkms - ok, so what is a TOKEN? How do I implement one myself? I have not seen anything about this in any tutorial I could find. I want to implement the token `foo` that will send a request to the address I give it as parameter. – Itay Moav -Malimovka Jul 09 '11 at 03:44
  • 1
    @Itay Moav: token is a term of parser/compiler. It is an "atom" of [AST](http://en.wikipedia.org/wiki/Abstract_syntax_tree). I think you need to dive into parsers, compilers and php internals to be able to add some `foo`. And I'm sure it is not possible to describe all of this by anyone in an answer. – zerkms Jul 09 '11 at 03:45
  • And if you were to do that, portability goes out the window. Just write a function foo() . – Rob Jul 09 '11 at 03:53
  • The word "theory" seems completely out of place here. PHP and C are practically-existing languages. – BoltClock Jul 09 '11 at 04:19
  • @BoltClock - why? I need to understand what the term Token/language construct means. @zerkms just explained it in his last comment – Itay Moav -Malimovka Jul 09 '11 at 06:05

1 Answers1

3

"Language constructs" are operations that are supported by special features in the language. In PHP, mostly anything that isn't a variable or a function is a language construct, as referred on the list of keywords page.

As a PHP user, you have no way of implementing new language constructs. Those exist only at the language parser level. It seems your objectives are similar to those of this question, and the answer will be the same.

Community
  • 1
  • 1
zneak
  • 134,922
  • 42
  • 253
  • 328