Why is the result null when printing mysqli objects with Var_dump ()?

Source: Internet
Author: User

The code is as follows:

$mysqli=new mysqli("localhost:3307","root","","test");var_dump($mysqli);print_r($mysqli);

Reply content:

The code is as follows:

$mysqli=new mysqli("localhost:3307","root","","test");var_dump($mysqli);print_r($mysqli);

$mysqli =new mysqli ("localhost:3306", "Root", "" "," Test ");
Var_export ($MYSQLI);
echo "
";
Var_dump ($MYSQLI);
echo "
";
Print_r ($MYSQLI);

The returned result is mysqli::__set_state (array (' affected_rows ' = null, ' client_info ' = null, ' client_version ' = null, ' Connect_errno ' = null, ' connect_error ' = null, ' errno ' = null, ' ERROR ' = null, ' field_count ' = null, ' Host_info ' = null, ' info ' = null, ' insert_id ' = null, ' server_info ' = null, ' server_version ' = null, ' Stat ' = null, ' sqlstate ' = null, ' protocol_version ' = null, ' thread_id ' = null, ' warning_count ' = null , ))

Checked the next var_export.
Var_export must return a valid PHP code, that is, the code returned by Var_export can be directly assigned to a variable as PHP code. And this variable gets the same type of value as the Var_export.
However, when the variable type is resource, it cannot be copied in simple copy, so var_export returns NULL when the Var_export variable is resource type.

Questions about the landlord may also be a similar reason

  • 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.