The underscore before PHP constructor construct is double underline

Source: Internet
Author: User
When I write PHP's class recently, I always encounter the error of function non object, knowing that the class is not instantiated, but I don't know where the error is.

Definition and usage

The construct () function creates a new SimpleXMLElement object.

If successful, the function returns an object. If it fails, it returns false.

Grammar

Construct (Data,options,is_url,ns,is_prefix)
Parameters Description
Data Necessary. The path or URL of a well-formed XML string or XML document.
Options Optional. Specifies the additional Libxml parameters.
Is_url Optional. Specifies whether the data parameter is a URL. The default is False.
Ns Optional.
Is_prefix Optional.

return value

Returns a SimpleXMLElement object that represents the data.

Example

<?php$xmlstring = <<<xml<?xml version= "1.0" encoding= "iso-8859-1"? ><note><to>george </to><from>john</from>

The output is similar to:

Don ' t forget the meeting! later to see construct's former _ is a, I am, last time this error, forget, now remember the function construct () {} is not function _construct () {}

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.