A good PHP learning experience will be made between PhP4 and PhP5.

Source: Internet
Author: User

I activated the PHP space yesterday and installed the PHP P4 version on the server. I started to use PHP to write things in the last 20 days. My own platforms are all PhP5. Of course I am very careful when writing them, because almost every segment Code The main points are to first check the reference and then write it out. Then we can see that those in the reference are supported by PhP4 and are newly added in PhP5. After the results are uploaded, they cannot be modified !!

1. Modify the class method call in the string. the string is written as follows in PhP5:
$ Htmlstr = <A href = "user. php? U = {$ dataobj-> getuserinfo ('name')} "> User Information </a>
HTML;
Finally, I have to change PhP4:
$ User = $ dataobj-> getuserinfo ('name ');
$ Htmlstr = <A href = "user. php? U = {$ user} "> User Information </a>
HTML;

2. Back-to-Back problem of class method calls, which I wrote in PhP5 as follows:
$ User = $ dataobj-> readrecord ()-> d_user;
In the end, I have to change it to PhP4.
$ ROW = $ dataobj-> readrecord ();
$ User = $ row-> d_user;
I want to add () as follows:
$ User = ($ dataobj-> readrecord ()-> d_user;
Let the object be reversed first, then call the attribute on the object, and then discard the object. However, it turns out that PhP4 has no such support capability !!

3. The default function parameter I wrote in PhP5:
function set ($ A, $ B = 3) {
echo $ B;
}< br> the call is set (4);
In PhP4, the default value of $ B cannot be obtained, you can use func_num_args (), func_get_arg (), and func_get_args () functions for reference. get variable length parameter

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.