The great God to help a few interview questions to give an answer

Source: Internet
Author: User
Tags learn php
1:select * from Tb_user WHERE (fid=10) or (fid=33) or (fid=22) or (fid=76) or (fid=13) or (fid=44);

To render the effect is FID for
10
33
22
76
13
44
Is there any way to achieve this?
2: $a = ' a/b/c/d/e.php '; $b = ' a/b/12/34/c.php '; Find the relative path of 2 files
3:empty_door A_b_c Write a function into Emptydoor ABC This is a simple way to write (I am using split in the Loop method)
4: A normal address bar http://www.baidu.com/test.php?id=10 write an efficient way to get PHP or. php
5:1 im software has 1000 people registered 1 a forum 500 people registration 1 B Forum 300 people registration
Now to synchronize the registration information to write a thought
6:JS combined with PHP Click Statistics button to get the IP time, etc. into the log file


Reply to discussion (solution)

The first one.
ORDER by Find_in_set (FID, ' 10,33,22,76,13,44 ')

1 、... ORDER by FID in (10,33,22,76,13,44)
2, put together to remove the same
a/b/c/d/e.php
a/b/12/34/c.php
3, do not understand what the meaning (I have not Microsoft programmer)
4, Print_r (Parse_url (' http://www.baidu.com/test.php?id=10 '));
Array
(
[Scheme] = http
[Host] = www.baidu.com
[Path] =/test.php
[Query] = id=10
)
See for yourself
5. Synchronization registration information is independent of the number of registered persons (insufficient condition)
6, the code will not write, anyway you can not understand (I can not write the code without the bare-handed)

The second question does not know the understanding is right, is obtains a/b/c/d/and a/b/12/34/?
If so, I'm used to the regular.
$a = ' a/b/c/d/e.php ';
Preg_matches ('. * * ', $a, $match);
$dir = $match [0];

The second question does not know the understanding is right, is obtains a/b/c/d/and a/b/12/34/?
If so, I'm used to the regular.
$a = ' a/b/c/d/e.php ';
Preg_matches ('. * * ', $a, $match);
$dir = $match [0];
.. /.. /c/d/
.. /.. /12/34/
Or
.. /c/d/
.. /12/34/

Hint Array_diff_assoc

Question 3:
First use the explode () function with "_" as the delimiter to get an array.
The loop turns the first bit of the array into uppercase, so you have to decide whether to do it in English first.

Question 3:
First use the explode () function with "_" as the delimiter to get an array.
The loop turns the first bit of the array into uppercase, so you have to decide whether to do it in English first.


That's the way I used it. The interview says there's an easier way to know.


The second question does not know the understanding is right, is obtains a/b/c/d/and a/b/12/34/?
If so, I'm used to the regular.
$a = ' a/b/c/d/e.php ';
Preg_matches ('. * * ', $a, $match);
$dir = $match [0];
.. /.. /c/d/
.. /.. /12/34/
Or
.. /c/d/
.. /12/34/

Hint Array_diff_assoc
Can the great God Lose a code?

Looks like all the interview questions Oh ~

That's the way I used it. The interview says there's an easier way to know.

Learn PHP soon this line does not

$str = "Empty_door a_b_c"; $str 2= Str_replace (' _ ', ', $str); $str 3= ucwords ($str 2); $str 4= str_replace (",", $str 3); echo Str_replace (' abc ', ' abc ', $STR 4);

The 3rd question is a little boring.

$s = ' empty_door a_b_c '; Echo preg_replace ('/\w+/e ', ' Join ', Array_map ("Ucwords", Explode ("_", "$ A")) ', $s);
Emptydoor ABC
  • 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.