File tree 3 files changed +55
-0
lines changed
solution/0000-0099/0027.Remove Element
3 files changed +55
-0
lines changed Original file line number Diff line number Diff line change @@ -172,6 +172,26 @@ impl Solution {
172
172
}
173
173
```
174
174
175
+ ### ** PHP**
176
+
177
+ ``` php
178
+ class Solution {
179
+
180
+ /**
181
+ * @param Integer[] $nums
182
+ * @param Integer $val
183
+ * @return Integer
184
+ */
185
+ function removeElement(& $nums, $val) {
186
+ for ($i = count($nums) - 1; $i >= 0; $i--) {
187
+ if ($nums[$i] == $val) {
188
+ array_splice($nums, $i, 1);
189
+ }
190
+ }
191
+ }
192
+ }
193
+ ```
194
+
175
195
### ** ...**
176
196
177
197
```
Original file line number Diff line number Diff line change @@ -167,6 +167,26 @@ impl Solution {
167
167
}
168
168
```
169
169
170
+ ### ** PHP**
171
+
172
+ ``` php
173
+ class Solution {
174
+
175
+ /**
176
+ * @param Integer[] $nums
177
+ * @param Integer $val
178
+ * @return Integer
179
+ */
180
+ function removeElement(& $nums, $val) {
181
+ for ($i = count($nums) - 1; $i >= 0; $i--) {
182
+ if ($nums[$i] == $val) {
183
+ array_splice($nums, $i, 1);
184
+ }
185
+ }
186
+ }
187
+ }
188
+ ```
189
+
170
190
### ** ...**
171
191
172
192
```
Original file line number Diff line number Diff line change
1
+ class Solution {
2
+
3
+ /**
4
+ * @param Integer[] $nums
5
+ * @param Integer $val
6
+ * @return Integer
7
+ */
8
+ function removeElement (&$nums , $val ) {
9
+ for ($i = count ($nums ) - 1 ; $i >= 0 ; $i -- ) {
10
+ if ($nums [$i ] == $val ) {
11
+ array_splice ($nums , $i , 1 );
12
+ }
13
+ }
14
+ }
15
+ }
You can’t perform that action at this time.
0 commit comments