質問編集履歴
2
質問文
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
配列から指定した複数文字をカウントしたいです。
|
2
|
+
配列から配列を検索することは可能でしょうか?
|
3
|
+
|
1
4
|
```ここに言語を入力
|
2
5
|
<?php
|
3
6
|
$bangou=array('1','2','3','4','5');
|
1
code機能の使用
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,15 +1,20 @@
|
|
1
|
+
```ここに言語を入力
|
1
2
|
<?php
|
2
3
|
$bangou=array('1','2','3','4','5');
|
3
4
|
$touban=array('4','5','6','7','8');
|
4
5
|
substr_count($touban,$bangou);
|
5
6
|
?>
|
7
|
+
```
|
6
8
|
|
7
9
|
期待する出力:2
|
8
10
|
|
11
|
+
出現するエラー:
|
12
|
+
```ここに言語を入力
|
9
|
-
|
13
|
+
PHP Fatal error: Uncaught TypeError: substr_count(): Argument #1 ($haystack) must be of type string, array given in /workspace/Main.php:4
|
10
14
|
Stack trace:
|
11
15
|
#0 /workspace/Main.php(4): substr_count()
|
12
16
|
#1 {main}
|
13
17
|
thrown in /workspace/Main.php on line 4
|
18
|
+
```
|
14
19
|
|
15
20
|
よろしくお願いします
|