How to echo an echo in php?

后端 未结 5 1198
轻奢々
轻奢々 2021-01-22 15:28

I have some basic PHP code:

$raceramps56[\"short\"] = \"My Test Product\";

$leftMenu = 

\'
5条回答
  •  余生分开走
    2021-01-22 15:44

    I thought I'd provide some extra information just so you understand.

    In your code:

    $raceramps56["short"] = "My Test Product";
    
    $leftMenu = 
    
    '
    ';

    You are including literally.

    Take a read of this. http://php.net/manual/en/language.types.string.php

    When I was first learning, I did not understand the different between literal ' and double quotes and it especially caused problems when I was trying to echo things.

    Take a look at this:

    
    

    If you were to use " " instead of ' you would not get the same output because " will interpret everything rather then take it literally.

    I hope this has been of additional help, even though you have had your question answered already.

提交回复
热议问题