Concatenating ECHO syntax in PHP

后端 未结 5 1119
南笙
南笙 2020-12-30 06:35

I have made a small function (WordPress), using echo .

/* .. Some code */
switch ($linktype) {
    case \"next\":
        echo \'

5条回答
  •  醉梦人生
    2020-12-30 06:54

    Well, an offtopic to counter Brad's offtopic.

    He says that commas are faster.
    That is just not true, as well as it's not true to say that one new car is cheaper than another if it costs 2 cents less. There are thousands differencies - service, gifts, even distance to the shop, etc. - making 2 cents difference totally negligible. A sane buyer wouldn't take 2 cents difference into account by any means.
    Same here.

    This answer is just deceiving, and makes you think wrong way. Wordpress is one of slowest applications in the world. And if one really want to speed it up, they have to do A LOT of job of profiling and speed optimization. An changing commas to dots wouldn't be in that number.
    That's the point: one learns that commas are faster and thinks "I am writing fast code!!!" while it's utterly wrong. First, code itself is always fast. I't s data manipulation that makes your code slow! Say, Wordpresss is parsing and loading several-magabyte of localization data into memory every time it's called! Placing this data into some cache will make your wordpress 2 times faster! That's what I'd "make a habit" of.
    While even if you change ALL dots in your code to commas, you will never ever be able to measure any difference. A real difference, not an artificial one. That's especially applicable to echo as no sane application would use echo for million times.

提交回复
热议问题