Stream Handlers

This feature allows you to extend the “FileSystem” with logic that is quite difficult to perform in other languages. For instance, the MS-Excel Stream handler provides the ability to create a MS Excel file as follows:

 

Magic Methods

These are fall-through methods that can be called every time you invoke a method that doesn’t exist as well as assign or read the same property among other things.

 

Standard Class as a Neat Container

Now, using an array for holding several attributes can be replace with a standard class, which is particularly helpful in a string while accessing these variables:

vs

 

Return Value of Include Files

Now, include files have a return value. And it is possible to assign it to a variable.

 

‘or’ operator has lower precedence than ‘=’

And you can take advantage out of this feature:

In a situation when the value of the first assignment evaluates to true, the second one will be ignored.

Variable variables and functions

This concept applies to object parameters as well ($some_object->$some_variable);

 

Functions with an undefined number of arguments

In PHP 7, func_get_args() provides the ability to use functions with an undefined number of arguments:

Other important hidden features of PHP 7

  • strtr()
  • extract()
  • range()
  • the static keyword
  • Then “and print” trick
  • minus character in variable names
  • HEREDOC syntax
  • fast block comments
  • array manipulation

 

보다 사용하기 편해졌고, 여러 규약에서 어느정도 벗어난 것 같으며, 확장성이 더해졌네요.

더 자세히 알아보고 싶으신 분은 이곳을 참고하세요.

  • Lv11
    글 보고 스크롤 하신 후 뒤로 가실분은 저를 Follow 하세요^^
  • Lv37
    대부분은 원래 있던 기능인데... ㅡ.ㅡ;;

    맨 위에 엑셀파일 생성 기능은 컴파일 옵션에 따라 될 수도 있고 안 될 수도 있을 것 같아요.
    만약 어디서나 쓸 수 있다면 엄청나게 편리할 듯!
  • Lv37
    엇 그런가요..?! 엑셀파일 생성 기능도 기존에 있던 것인가요?
    한번 해보고싶었는데..
  • Lv16
    액셀이야 기본 베이스가 xml이니.. 뭐 ㅎㅎ