Solve the problem of PHP Chinese garbled

Source: Internet
Author: User
This article to share the content is about to solve the PHP Chinese garbled problem, has a certain reference value, the need for friends can refer to

We are writing the following PHP code:

<?php$sum=0; $total =1.2; $sum = $total; echo GetType ($sum); Echo ' </br> '; $sum 1=0; $total 1= $sum; Echo GetType ($ TOTAL1);//Gets the type of the variable $sum3=100;echo ' </br> '; Settype ($sum, "string");//sets the type of the variable echo GetType ($sum 3); Echo ' </br > '; Echo ' determines whether a variable exists: '; $a =5;echo isset ($a);? >

, we will find PHP garbled

The following situation occurs:

Double
Double
Integer
Arrival Yukata 柇 Juan € Juan 彉 stated expiry refer 忔 ionizing å ﹀ workspace 鍦: 1

In other words, it is the Chinese language that determines whether a variable exists: 1 '

How to solve?


The method is simple, add in the code

Header ("Content-type:text/html;charset=utf-8");

The code is as follows:

<?phpheader ("Content-type:text/html;charset=utf-8"), $sum =0, $total =1.2; $sum = $total; echo GetType ($sum); Echo ' </br> '; $sum 1=0; $total 1= $sum; Echo GetType ($total 1);//Gets the type of the variable $sum3=100;echo ' </br> '; Settype ($sum, " String ");//sets the type of the variable echo GetType ($sum 3); Echo ' </br> '; Echo ' determines whether a variable exists: '; $a =5;echo isset ($a); >

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.