Joke Collection Website - Blessing messages - Php interview problem solution

Php interview problem solution

1,

var x = document . getelementbyid(" img 1 ");

var title = document . getelementbyid(" img 1 ")。 Title;

var Sina _ title = document . getelementbyid(" img 1 ")。 Sina _ title

2、serialize(),unserialize();

3. Different coding methods. Urlencode () encodes a string with a URL. For example, spaces will become plus signs.

Rawurlencode () encodes the url into a string-specific format of the url, and special characters are converted back to the format of a percent sign followed by two hexadecimal digits.

4、strip_tags(),html _ entity _ decode();

5,$ str = preg _ replace("/\ & lt; Script. * \ & gt。 * \ & lt\/script \ & gt; /i ","",$ str);

6. If there is no matching data, the left join and the left join table will not affect the result.

seven

SELECT name,score FROM TL _ user LEFT JOIN TL _ score ON TL _ user。 ID=tl_score。 Proof of identity

7 system (), execute (), through ()

8,json_decode,json_encode

9 isset() empty()

10 The latter is more authoritative than the former. If the latter is off, the former is useless even if it is E-ALL.

1 1, $_SERVER[' remote _ addr'];

12,incov()

Echo iconv ("gbk", "UTF-8", "we");

mb_convert_encoding($str,“GBK”,“UTF-8”)

13 explode()split(); Implosion () connection ()

14 pay attention to a lot, too lazy to write.

two

1, timeout, the server has closed the connection.

Static table fields are fixed in length, automatically filled, fast in reading and writing, and easy to cache and repair. However, it takes up a lot of hard disks, and the length of dynamic table fields is variable, which saves hard disks, but it is complicated, prone to fragmentation, slow and difficult to rebuild after problems occur.

3InnoDB and MyISAM are the two most commonly used table types in MySQL, each of which has its own advantages and disadvantages, depending on the specific application. The basic difference is that MyISAM type does not support advanced processing, such as transaction processing, while InnoDB type does. MyISAM-type tables emphasize performance and are faster than InnoDB-type tables, but they do not provide transaction support, while InnoDB provides transaction support for advanced database functions such as foreign keys.

MyIASM is a new version of IASM table with the following extensions:

Portability of binary hierarchy.

Empty column index.

Variable length rows have fewer fragments than ISAM tables.

Support large files.

Better index compression.

Better keys? Statistical distribution.

Better and faster automatic incremental processing.

The biggest advantage of 1 MySQL is a simple operation of selecting, inserting and updating under MyISAM engine.

2.MyISAM data files can be copied in different operating systems, which is very important and convenient to deploy.

The following are some details and specific implementation differences:

1.InnoDB does not support full-text indexing.

2.InnoDB doesn't save the specific number of rows in the table, that is to say, when executing select count(*) from table, InnoDB scans the whole table to calculate how many rows there are, while MyISAM only needs to simply read the saved number of rows. Note that when the count(*) statement contains a where condition, the operations of the two tables are the same.

3. For the field of AUTO_INCREMENT type, InnoDB must only contain the index of this field, but in MyISAM table, it can establish a joint index with other fields.

4. When deleting from the table, InnoDB will not rebuild the table, but delete it line by line.

5. Number five. Loading tables from main operations is not applicable to InnoDB. The solution is to change the InnoDB table into MyISAM table first, and then change it into InnoDB table after importing data, but it is not suitable for tables with additional InnoDB features (such as foreign keys).

In addition, the row lock of the InnoDB table is not absolute. If MySQL cannot determine the scope to scan when executing SQL statements, InnoDB table will also lock the whole table, for example, Update Table Set num = 1, where the Name is similar to "%AAA%".

Based on my understanding of storage engines, I think InnoDB supports foreign keys. When the amount of data can be described as "huge", the query speed of InnoDB should be faster than MyISAM on the basis of good index.

Before Falcon has a stable version, I think MyISAM is an available option.

No table is everything. Only by choosing the appropriate table type according to the business type can we give full play to the performance advantages of MySQL.

3, both are 1. I'm too lazy to answer. Go to sleep.