PHP Basic Questions (original)

Source: Internet
Author: User

PhpBasic Questions (original)

what are the output modes of 1.PHP? Individual differences?

Echo, is a keyword for PHP, the output string, if it is an array, the output aarray

Var_dump (), which is used to output variable details, typically used for debugging

Print (), format the output string

Print_r (), printing variable information

2. Under UTF8 code, PHP $str = ' interview title ', substr ($str, 0,6) and JS str= ' interview topics ', Str.substr (0,6) What are the outputs?

The former output ' interview ', the latter output ' interview title ', explaining that the PHP substr () function is to intercept the character length, JS substr () intercept the string length.

3.PHP function file_put_contents () What is the difference between an append write and a overwrite write?

is the third parameter file_append

4. How to $arr =array (Array (' a '), array (' B '), Array (' C '), Array (' d ')), delete the element with the key value C , the key value is not changed? How do I make a change to its key value?

foreach ($arr as $k = = $v) {

if ($v [0]== ' C ') {

Array_splice ($arr, $k, 1);//Key value change

Unset ($arr [$k]);//Key value unchanged

}

}

5.JS functions for displaying and hiding HTML modules?

Display: Show (), Hide: Hide ()

6. In order to prevent PHP execution timeout, in the execution of the script to join PHP which self-function?

Set_time_limit (0)

7. What are the encryption methods you know?

3des,base64,md5

8.PHP regular Match user mailbox,PHP Regular non-greedy mode parameter is? What is the difference between Preg_match () and preg_match_all () ?

/^ (([a-za-z_]\w+) | [1-9] [0-9] {4,9}) @[a-z0-9a-z]+ (\.[ a-za-z]+) {1,3}$/Of course, this is a lot.

Parameter/u

The difference is that the return value, which returns TRUE or FALSE, returns the processed string result.

9.PHP using global variables within a function, how do I handle them?

Keyword global

what are the functions of 10.PHP referencing files? What's the difference? thinkphp is a method name for importing an extension class library?

Include (), when introducing a file with syntax errors, continue execution

Include_once (), introduce only one file at a time

Require () is more efficient than include (), when introducing a file with syntax errors, stop execution ,

Require_once (), introduce only one file at a time

Thinkphp:import ()

What are the 11.PHP system's own string substitution functions?

STRTR (), Str_replace (), Preg_replace ()

What are the common commands for 12.Linux?

File or directory directives:

CD,ls,rm,mv,cp,chmod ,touch,vim,zip,tar

Maintenance:

Top,dh,free,PS,kill,du

How to rewrite the URL of the site , such as www.xxx.com/xxx/xxx.php rewrite into www.xxx.com/xxx/(pseudo-static).

First open the Apache Server configuration file, open the ' LoadModule rewrite_module modules/mod_rewrite.so ' module and define one in the root directory of the Web site . htaccess file , file write:

<ifmodule mod_rewrite.c>

Rewriteengine on

Rewritecond%{request_filename}!-d

Rewritecond%{request_filename}!-f

Rewriterule ^ (. *) $ index.php/$1 [qsa,pt,l]

Rewriterule ^ (. *) xxx/$ $1/xxx/xxx.php

</IfModule>

PHP basic Question (original)

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.