Browser compatibility-about PHP array to object, print the result when the garbled

Source: Internet
Author: User

  
   

代码是上面这样的
结果成这样的,我知道?的位置应该是'*'这个前缀,但是怎么样能让它正常显示呢


header头:


浏览器编码:

后来用Print_r试了下 可以正常使用:
Array ( [intpub] => 123 [pub] => public [*pro] => protected [objpri] => private )
但是这是为什么吗呢?求指导

Reply content:
 !--? php//header ("content_type:text/html ;    Charset=utf-8 "), class obj{public $intpub = 123;    Public $pub = ' public ';    Protected $pro = ' protected ';    Private $pri = ' private ';    Const con= ' const ';    Public Function Thefunc () {return ' Func '; }} $obj =new obj (); Var_dump ((array) $obj);//  

code is the
result like this, I know? should be the ' * ' prefix, but how can it be displayed correctly


Header:


Browser code:

later tested with Print_r:
Array ([intpub] = 123 [Pub] = public [*pro] = protected [OBJPRI] + private )
But why is that? For guidance

Vardump Normal print out is public, The garbled ones are those that are not public.
This problem I have not met, after all, through the actual class directly print properties is not necessary, can be put into the method to print it out.
BTW, programming to result-oriented bar, this kind of more strange problems can be recorded, later to see or ask a master.

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