Home > Backend Development > PHP Tutorial > Java programmers learn PHP II

Java programmers learn PHP II

WBOY
Release: 2016-07-29 08:57:13
Original
935 people have browsed it

I am a web developer and learning a language. It's just the general syntax, plus specificity, and then CRUD, plug-in usage.

Let’s talk about the main ones in php syntax, $bianliang .php weak type. Although there are classes, they are not object-oriented. They are functions, not methods. So the calling method $obj->fun(). has no [.] call.

1. Constructor method

function __construct(){} Pay attention to the two underscores

2. The subclass calls the parent class (unlike java which calls the parent class by default)

parent::__construct(6,10);

3. There is also a special hook method (not very useful, it’s a feature)

function __destruct(){
}

Let’s talk about a few more special methods

4.include("") //Similar jsp import


5.require and include are almost exactly the same, except In addition to handling failure differently. require generates an E_COMPILE_ERROR level error on error. In other words, it will cause the script to abort and include will only generate a warning (E_WARNING), and the script will continue to run. (Very commonly used)

6.define (‘’, ‘’) Define a constant preceded by a name, followed by a value (very commonly used);

The above introduces Java programmers to learn PHP II, including aspects of content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template