[Happy to be original] PHP Old driver's Guide

Source: Internet
Author: User
Tags array sort form post function definition session id mysql query php and mysql php cli zend framework
1, who is the father of PHP. P

What is the difference between Rasmus Lerdorf, Loedorf 2, $name and $ $name? P

$name is a variable, the $ $name is a reference variable, such as: $name = ' sex '; $ $name = ' male '; Then $sex = ' male '; 3, how to submit form form instead of the Submit button. J

Use the Submit () method of JavaScript, such as when OnClick calls Document.formname.submit () 4, and what methods can be used to get data from a MySQL result set. M

Mysql_fetch_row,mysql_fetch_array,mysql_fetch_object,mysql_fetch_assoc 5, Mysql_fetch_object () and Mysql_fetch_ What is the difference between array (). M

The former returns an object and needs to traverse the data in an object's way, which returns an array that can traverse the data using an associative array or an indexed array. 6. What is the difference between get and post methods? P

1 Get method has data length limit, maximum 2kb,post method has no limit. 2 The Get method request data is displayed directly on the URL, unsafe, and the post method is suitable for transmitting sensitive data. 7, how to obtain "pcds.co.in" from the http://info@pcds.co.in. P

Preg_match ("/@ (\s+) $/", "http://info@pcds.co.in", $matches); Echo $matches [1]; 8, with PHP and MySQL how to create a database. P

mysql_create_db (' dbname '); 9, require and include what is the difference. P

are used to load files. 1) include alarm report, require report fatal error. 2) Include execution when the file is read and evaluated every time, require only once. 3) include controlled by process control, require does not go process control. 10, in the PHP file can be used many times include ("xyz.php"). P

OK, but if there is a function definition in xyz.php, the second include reports that the function cannot redefine the error. 11, the MySQL data table engine What is the difference, which is the default.

1) MyISAM, by default, this storage engine saves three files on the hard disk, the name of the table, the suffix name is. frm (storage table structure),. MYD (storage data),. Myi (storage index). 2) InnoDB, a storage engine that supports transaction security, supports Commit, rollback, and recovery. 3) Merge, 4 Heap (MEMORY), memory storage Engine 5 BDB (BERKELEYDB), same support for Submit and rollback 6) EXAMPLE, 7) federated, 8) ARCHIVE, 9) CSV, ten) Blackhole, 12. Function of header ().

A message header can be sent to the client and the header () function must be invoked before any actual output is sent. Use its header () redirect, such as header (' location:http://baidu.com/'); 13. How to execute PHP script in command line mode.

Using the PHP CLI (Command line Interface), use the script name as an argument, such as: $ PHP test1.php 14, how to configure the Zend framework so that it supports shorthand notation.?? "?"

Modify the php.ini file and set the Short_open_tag=on to open. 15, Shopping cart online validation i.e. how can we configure Paypal,etc.?

Nothing more we have the redirect to the PayPal URL after submit all information needed by payPal like Amount,adres SS etc. 16, function of NL2BR ().

Add the HTML line break before
Label. 17, what is htaccess. Why use it.

The. htaccess file is the configuration file method provided by the Apache server, which enables you to implement the underlying configuration changes for the specified directory, and the directory in which the file is placed and all its directories are applicable to the configuration in the file. 18, how to obtain the client IP address, the source address.

Use $_server[' remote_addr ' and $_server[' http_referer '. 19. Why use the lamp environment instead of other programs, services, and operating environments.

Lamp is open source, Linux is more secure than Windows, Apache is more functional and secure than IIS, MySQL is currently the most popular open source database, PHP is faster than other scripting languages like ASP. 20, how to use MySQL encryption and decryption data.

Use Aes_encrypt () and Aes_decrypt (). 21, how to encrypt the user name and password in PHP?

Encryption and decryption functions in PHP: Encryption and decryption Aes_encryt () Aes_decrypt () ENCODE () DECODE () Des_encrypt ()-Des_decrypt () ENCRYPT () irreversible MD5 () irreversible old_p Assword () irreversible PASSWORD () irreversible SHA () and SHA1 () irreversibly irreversible uncompressed_length () 22, the characteristics and advantages of object-oriented programming.

The main advantage of object-oriented program is its easy maintenance and scalability, which can effectively reduce maintenance cost. Compared with procedural programming, it is closer to the real world cognitive model, easier for non-technical people to understand, and makes it easier for them to participate and improve the project. For some systems, object-oriented methods can accelerate development time, because many objects are standard cross-platform reusable, such as time management, shipping, shopping carts and other components that can be reused for multiple systems. 23. The difference between procedural programming and object-oriented programming.

1 process programming is easy to get started, but it is more complex and difficult to understand the whole system than object-oriented programming. 2 The process of programming, it is difficult to use MVC and other design patterns. 3 in object-oriented programming, we can use inheritance and polymorphism to reuse functions, but the process of programming needs to be copied and pasted. 24. What is the function of the friend function? 25, public, private, protected,static, transient, final and volatile what is the difference.

Transient: Temporary variables (private) cannot be serialized. Volatile: Used when multithreading, variables declared as Volatile will not be optimized by the compiler because their values may change at any time. 26. What types of PHP errors are available.

1) Notices: hints, such as using undefined variables. 2) Warnings: Warning, such as include a non-existent file. 3 Fatal errors: Fatal error, will terminate script run, such as instantiating a nonexistent class, accessing a nonexistent function. 27, substr and SUBISTR functions.

SUBSTR returns a portion of the string, starting from the first character, and the number of offsets and intercepts can be passed. Subistr is a substr version of the case. 28, PhP3, PHP4 and php5 what is the difference. Undone

A lot of difference, enumerate some: 29, how to convert ASP page to PHP page.

There are many tools that can be implemented, such as http://asp2php.naken.cc./ 30, function htmlentities.

Converts a character to an HTML entity. such as "&" will be converted to "&" 31, how to get the number of seconds in the current time.

$second = Date ("s"); 32, how to convert the time zone in PHP.

Use the Date_default_timezone_get and Date_default_timezone_set functions. 33, UrlEncode and urldecode what role.

Encodes and decodes a URL string that, when encoded, converts a-_ numeric character other than the number of characters to a percent semicolon (%) followed by a two-bit hexadecimal number, and a space is encoded as a plus sign (+). This encoding is the same encoding as the WWW form post data and is encoded in the same way as the application/x-www-form-urlencoded media type. 34. What is the difference between unlink and unset functions?

Unlink is used to delete files and unset are used to destroy variables. 35, how to write variables to the session.

$_session[' name ' = ' Sonia '; 36, use the PHP picture function How to get picture size, type, width and height.

Exif_imagetype () to get the picture type. GetImageSize () to get the picture size. Imagesx () to get the picture width. Imagesy () to get the picture height. 37, how to obtain user browser information PHP.

$_server[' Http_user_agent '] 38, php upload file size limit is how much, how to modify the upper limit.

The default upper limit is 2MB, you can modify the php.ini adjustment as follows: Upload_max_filesize = 2M 39, how to increase the PHP script execution time limit.

Modify PHP.ini, as follows: Max_excution_time = 30 Execution time per script, in seconds. 40, how to back up the MySQL table, how to recover.

1 mysqldump Backup: mysqldump parameters dbname > Dbname.sql restore: MySQL dbname < dbname.sql or source Dbname.sql 2) SQL syntax Backup: Backups T Able tbl_name to '/tmp/db_name/' or select * into outfile '/tmp/db_name/tbl_name.txt ' from tbl_name recovery: Restore TABLE from '/ tmp/db_name/' or load DATA INFILE '/tmp/db_name/tbl_name.txt ' into TABLE tbl_name 41, how to optimize or increase the speed of MySQL query statements.

1) Use the Limit keyword to control the number of data bars without using the SELECT *, only the desired field 2 is added to the appropriate field (index 3). 42, what method can get the current session ID.

session_id () 43, how to destroy the session, how to destroy the variables in the session.

Session_destroy can destroy the current sesssion Session_unset can release the variable 44 in session , PHP How to set up and destroy cookies.

Settings: Setcookie (' user ', value, expire, path, domain); Destroy: Setcookie (' User ', ', Time () -3600) 45, what methods can pass variables between pages.

What is the difference between get/querystring POST 46, Ereg_replace, and Eregi_replace.

are replaced, which ignores case 47, which array sort functions are available.

Sort (), Arsort () Assort (), Ksort () Natsort (), Natcasesort () Rsort (), Usort () Array_muletisort (), Uksort () 48, How to get the number of elements in an array.

1) sizeof (), alias 2 of Count () count () 49, what is the effect of Session_set_save_handler.

A user-level session store function that stores sessions in a database. 50, how to judge a variable is a number.

1 is_numeric (), returns False if a numeric or numeric string returns TRUE. 2) isNaN (), used to determine whether a value is not a number

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.