錯題總結

1.array_merage和相加的區別php

數字索引  array_merge 會徹底合併成新的數組,相加的話會根據key值是否相同優先保留前者。css

字符串索引, 相同key值array_merge後者取代前者,相加前者取代後者。mysql

 2 trim函數nginx

$a = 'aabbc';web

echo trim($a,'ab');redis

輸出csql

由於trim是按照字符串來匹配刪除的,至關於正則裏面a+b+;數據庫

 

3.nginx -t reload 所作的事情。。部分在使用的js,css不會改變,當未使用的時候則改變服務器js,css文件內容。平滑重啓nginx。不會停服務。json

 

4.數據庫索引選擇  當有索引abc和索引c的時候,查找where c=xxx用的是abc的索引,並且效率要低於用索引C,這個原理還要再查下數組

 

5.php-fpm php的進程管理器,用一個進程管理鏈接數之類的參數配置,若是要再啓動Php進程,則在此進程下開啓一個新的php進程。

6.獲取當前月份最後一天。  echo date('Y-m-d', strtotime(date('Y-m-01') . ' -1 month'));

7.數據存儲在redis裏的意義,利用redis的數據類型的特性,更方便操做。

之前覺得僅僅是由於操做的原子性,針對高併發。

8.php7的特性。 原文參考: https://blog.csdn.net/h330531987/article/details/74364681

1.能夠強制函數參數類型,例如整型 bool型

function aa(int a){}

2.返回值類型聲明。function arraySum(array $aa) : array{}

3. ??

4.太空船操做符

 $a <==>$b 相等0.小於-1 大於1

5.define支持數組

  define('aa',[1,2,3]);

6.匿名函數直接實例化$app->getlogger(new class $bb implements logger){}

7.namespace能夠經過use 一次性導入

  use \{Class A,Class B,Class C}

8.intdiv(10,3) 3//除法取整去餘

9.session_start增長數組參數能夠替代php.ini的配置

  session_start([ 'cache_limiter' => 'private', 'read_and_close' => true ]);

10.random_bytes() 隨機字符串

  random_int() 隨機數字

11.能夠用字符串訪問靜態方法

class foo
{
static $bar = 'baz';

public static function bar(){
return 222;
}
}

echo 'foo'::bar(); // 222
echo 'foo'::$bar(); // baz
exit;

 

12.php內置一個web服務器

把當前目錄做爲Root Document只須要這條命令便可:

php -S localhost:3300

也能夠指定其它路徑

php -S localhost:3300 -t /path/to/root 

還能夠指定路由

php -S localhost:3300 router.php

13.支持延遲及靜態綁定。static::who()

14.支持goto  goto end;  

   a:

  for(xxx){

  if(xxx)
  goto end;

  }

   end:

15. callstatic()魔術方法

16.newdoc語法

// Nowdoc 單引號 PHP 5.3以後支持
$name = 'MyName';
echo <<<'EOT'
My name is "$name".
EOT;
//上面代碼輸出 My name is "$name". ((其中變量不被解析)
// Heredoc不加引號
echo <<<FOOBAR
Hello World!
FOOBAR;
//或者 雙引號 PHP 5.3以後支持
echo <<<"FOOBAR"
Hello World!
FOOBAR;

17.const 定義常量 
const CONSTANT = 'Hello World';

18。json 中文支持  JSON_UNESCAPED_UNICODE

19.json轉義語法 echo "\u{9876}"

20.** 冪運算

21.tratis 魔術常量。替換繼承的類方法

22.非變量獲取下標  
echo "foobar"[2]; //輸出o

23.常量加強,容許常量做爲函數默認值。

24.支持常量權限 private const aa = 4

25。參數跳躍

function add(...$args)
{
$result = 0;
foreach($args as $arg)
$result += $arg;
return $result;
}

26.函數參數能夠爲空

function test(?string $name)
{
var_dump($name);
}

 

27。返回值void函數,要麼沒有retrun 要麼直接return

function swap(&$left, &$right) : void
{
if ($left === $right) {
return;
}
$tmp = $left;
$left = $right;
$right = $tmp;
}
$a = 1;
$b = 2;
var_dump(swap($a, $b), $a, $b);

28.參數解包

function add($a, $b, $c) {
return $a + $b + $c;
}
$arr = [2, 3];
add(1, ...$arr);

 

 

29.yield 迭代器

 

30. foreach新寫法list

$array = [
[1, 2],
[3, 4],
];
foreach ($array as list($a, $b)) {
echo "A: $a; B: $b\n";
}

31 gmp數據支持相加減

32.boolval

0: false
42: true
0.0: false
4.2: true
"": false
"string": true
"0": false
"1": true
[1, 2]: true
[]: false
stdClass: true

 

33.foreach再也不改變內部指針。

34.十六進制數字再也不認爲是數字。

35

被移除的函數列表以下:
call_user_func() 和 call_user_func_array()從PHP 4.1.0開始被廢棄。
已廢棄的 mcrypt_generic_end() 函數已被移除,請使用mcrypt_generic_deinit()代替。
已廢棄的 mcrypt_ecb(), mcrypt_cbc(), mcrypt_cfb() 和 mcrypt_ofb() 函數已被移除。
set_magic_quotes_runtime(), 和它的別名 magic_quotes_runtime()已被移除. 它們在PHP 5.3.0中已經被廢棄,而且 在in PHP 5.4.0也因爲魔術引號的廢棄而失去功能。
已廢棄的 set_socket_blocking() 函數已被移除,請使用stream_set_blocking()代替。
dl()在 PHP-FPM 再也不可用,在 CLI 和 embed SAPIs 中仍可用。
GD庫中下列函數被移除:imagepsbbox()、imagepsencodefont()、imagepsextendfont()、imagepsfreefont()、imagepsloadfont()、imagepsslantfont()、imagepstext()
在配置文件php.ini中,always_populate_raw_post_data、asp_tags、xsl.security_prefs被移除了。

36.引用賦值會報錯,示例以下

class C {}
$c =& new C;

37.password_hash.password_verify. php7已經不廢棄加鹽了

38.ini中沒有#只有;進行註釋

39.再也不提供 $HTTP_RAW_POST_DATA 變量。 請使用 php://input 做爲替代。

 

 

補充:pdo預綁定插入並非直接編譯成一條sql,而是編譯成一個流程式的sql。好比@set a=xxxx 當設置變量的時候就會將關鍵字進行轉義了。原理是mysql的預處理,不會把數據和插入弄成一個語句。

相關文章
相關標籤/搜索