From 263fd37ebd6ca96cb6f018b7fde99405b910e870 Mon Sep 17 00:00:00 2001
From: ZylalMinollari <zmiollari@gmail.com>
Date: Tue, 20 Feb 2024 10:38:12 +0100
Subject: [PATCH 1/6] PHP solution of problems 0011,0012

---
 .../0011.Container With Most Water/README.md  | 32 +++++++++++++++
 .../README_EN.md                              | 32 +++++++++++++++
 .../Solution.php                              | 29 ++++++++++++++
 .../0000-0099/0012.Integer to Roman/README.md | 40 +++++++++++++++++++
 .../0012.Integer to Roman/README_EN.md        | 40 +++++++++++++++++++
 .../0012.Integer to Roman/Solution.php        | 37 +++++++++++++++++
 6 files changed, 210 insertions(+)
 create mode 100644 solution/0000-0099/0011.Container With Most Water/Solution.php
 create mode 100644 solution/0000-0099/0012.Integer to Roman/Solution.php

diff --git a/solution/0000-0099/0011.Container With Most Water/README.md b/solution/0000-0099/0011.Container With Most Water/README.md
index 4d81674da317f..96c789483c657 100644
--- a/solution/0000-0099/0011.Container With Most Water/README.md	
+++ b/solution/0000-0099/0011.Container With Most Water/README.md	
@@ -206,6 +206,38 @@ public class Solution {
 }
 ```
 
+```php
+class Solution
+{
+    /**
+     * @param int[] $height
+     * @return int
+     */
+
+    function maxArea($height)
+    {
+        $left = 0;
+        $right = count($height) - 1;
+        $maxArea = 0;
+
+        while ($left < $right) {
+
+            $area = min($height[$left], $height[$right]) * ($right - $left);
+
+            $maxArea = max($maxArea, $area);
+
+            if ($height[$left] < $height[$right]) {
+                $left++;
+            } else {
+                $right--;
+            }
+        }
+
+        return $maxArea;
+    }
+}
+```
+
 <!-- tabs:end -->
 
 <!-- end -->
diff --git a/solution/0000-0099/0011.Container With Most Water/README_EN.md b/solution/0000-0099/0011.Container With Most Water/README_EN.md
index 68cdb99432b7d..403470079cb3b 100644
--- a/solution/0000-0099/0011.Container With Most Water/README_EN.md	
+++ b/solution/0000-0099/0011.Container With Most Water/README_EN.md	
@@ -201,6 +201,38 @@ public class Solution {
 }
 ```
 
+```php
+class Solution
+{
+    /**
+     * @param int[] $height
+     * @return int
+     */
+
+    function maxArea($height)
+    {
+        $left = 0;
+        $right = count($height) - 1;
+        $maxArea = 0;
+
+        while ($left < $right) {
+
+            $area = min($height[$left], $height[$right]) * ($right - $left);
+
+            $maxArea = max($maxArea, $area);
+
+            if ($height[$left] < $height[$right]) {
+                $left++;
+            } else {
+                $right--;
+            }
+        }
+
+        return $maxArea;
+    }
+}
+```
+
 <!-- tabs:end -->
 
 <!-- end -->
diff --git a/solution/0000-0099/0011.Container With Most Water/Solution.php b/solution/0000-0099/0011.Container With Most Water/Solution.php
new file mode 100644
index 0000000000000..7e4025b882e21
--- /dev/null
+++ b/solution/0000-0099/0011.Container With Most Water/Solution.php	
@@ -0,0 +1,29 @@
+class Solution
+{
+    /**
+     * @param int[] $height
+     * @return int
+     */
+
+    function maxArea($height)
+    {
+        $left = 0;
+        $right = count($height) - 1;
+        $maxArea = 0;
+
+        while ($left < $right) {
+
+            $area = min($height[$left], $height[$right]) * ($right - $left);
+
+            $maxArea = max($maxArea, $area);
+
+            if ($height[$left] < $height[$right]) {
+                $left++;
+            } else {
+                $right--;
+            }
+        }
+
+        return $maxArea;
+    }
+}
diff --git a/solution/0000-0099/0012.Integer to Roman/README.md b/solution/0000-0099/0012.Integer to Roman/README.md
index 6e406775637ec..23501e8b23db8 100644
--- a/solution/0000-0099/0012.Integer to Roman/README.md	
+++ b/solution/0000-0099/0012.Integer to Roman/README.md	
@@ -181,6 +181,46 @@ public class Solution {
 }
 ```
 
+```php
+class Solution
+{
+    /**
+     * @param int $num
+     * @return string
+     */
+
+    function intToRoman($num)
+    {
+        $values = [
+            'M' => 1000,
+            'CM' => 900,
+            'D' => 500,
+            'CD' => 400,
+            'C' => 100,
+            'XC' => 90,
+            'L' => 50,
+            'XL' => 40,
+            'X' => 10,
+            'IX' => 9,
+            'V' => 5,
+            'IV' => 4,
+            'I' => 1,
+        ];
+
+        $result = '';
+
+        foreach ($values as $roman => $value) {
+            while ($num >= $value) {
+                $result .= $roman;
+                $num -= $value;
+            }
+        }
+
+        return $result;
+    }
+}
+```
+
 <!-- tabs:end -->
 
 <!-- end -->
diff --git a/solution/0000-0099/0012.Integer to Roman/README_EN.md b/solution/0000-0099/0012.Integer to Roman/README_EN.md
index 110d2047b445c..6519e6941420d 100644
--- a/solution/0000-0099/0012.Integer to Roman/README_EN.md	
+++ b/solution/0000-0099/0012.Integer to Roman/README_EN.md	
@@ -168,6 +168,46 @@ public class Solution {
 }
 ```
 
+```php
+class Solution
+{
+    /**
+     * @param int $num
+     * @return string
+     */
+
+    function intToRoman($num)
+    {
+        $values = [
+            'M' => 1000,
+            'CM' => 900,
+            'D' => 500,
+            'CD' => 400,
+            'C' => 100,
+            'XC' => 90,
+            'L' => 50,
+            'XL' => 40,
+            'X' => 10,
+            'IX' => 9,
+            'V' => 5,
+            'IV' => 4,
+            'I' => 1,
+        ];
+
+        $result = '';
+
+        foreach ($values as $roman => $value) {
+            while ($num >= $value) {
+                $result .= $roman;
+                $num -= $value;
+            }
+        }
+
+        return $result;
+    }
+}
+```
+
 <!-- tabs:end -->
 
 <!-- end -->
diff --git a/solution/0000-0099/0012.Integer to Roman/Solution.php b/solution/0000-0099/0012.Integer to Roman/Solution.php
new file mode 100644
index 0000000000000..a6106716d5b81
--- /dev/null
+++ b/solution/0000-0099/0012.Integer to Roman/Solution.php	
@@ -0,0 +1,37 @@
+class Solution
+{
+    /**
+     * @param int $num
+     * @return string
+     */
+
+    function intToRoman($num)
+    {
+        $values = [
+            'M' => 1000,
+            'CM' => 900,
+            'D' => 500,
+            'CD' => 400,
+            'C' => 100,
+            'XC' => 90,
+            'L' => 50,
+            'XL' => 40,
+            'X' => 10,
+            'IX' => 9,
+            'V' => 5,
+            'IV' => 4,
+            'I' => 1,
+        ];
+
+        $result = '';
+
+        foreach ($values as $roman => $value) {
+            while ($num >= $value) {
+                $result .= $roman;
+                $num -= $value;
+            }
+        }
+
+        return $result;
+    }
+}

From 1f9c25e3758c17ec2ddc5974d7b09dc41ddfd635 Mon Sep 17 00:00:00 2001
From: ZylalMinollari <ZylalMinollari@users.noreply.github.com>
Date: Tue, 20 Feb 2024 09:44:49 +0000
Subject: [PATCH 2/6] style: format code and docs with prettier

---
 .../0000-0099/0011.Container With Most Water/README.md     | 7 ++-----
 .../0000-0099/0011.Container With Most Water/README_EN.md  | 7 ++-----
 solution/0000-0099/0012.Integer to Roman/README.md         | 6 ++----
 solution/0000-0099/0012.Integer to Roman/README_EN.md      | 6 ++----
 4 files changed, 8 insertions(+), 18 deletions(-)

diff --git a/solution/0000-0099/0011.Container With Most Water/README.md b/solution/0000-0099/0011.Container With Most Water/README.md
index 96c789483c657..6dbd8cf41fce7 100644
--- a/solution/0000-0099/0011.Container With Most Water/README.md	
+++ b/solution/0000-0099/0011.Container With Most Water/README.md	
@@ -207,21 +207,18 @@ public class Solution {
 ```
 
 ```php
-class Solution
-{
+class Solution {
     /**
      * @param int[] $height
      * @return int
      */
 
-    function maxArea($height)
-    {
+    function maxArea($height) {
         $left = 0;
         $right = count($height) - 1;
         $maxArea = 0;
 
         while ($left < $right) {
-
             $area = min($height[$left], $height[$right]) * ($right - $left);
 
             $maxArea = max($maxArea, $area);
diff --git a/solution/0000-0099/0011.Container With Most Water/README_EN.md b/solution/0000-0099/0011.Container With Most Water/README_EN.md
index 403470079cb3b..f321d2f5d264a 100644
--- a/solution/0000-0099/0011.Container With Most Water/README_EN.md	
+++ b/solution/0000-0099/0011.Container With Most Water/README_EN.md	
@@ -202,21 +202,18 @@ public class Solution {
 ```
 
 ```php
-class Solution
-{
+class Solution {
     /**
      * @param int[] $height
      * @return int
      */
 
-    function maxArea($height)
-    {
+    function maxArea($height) {
         $left = 0;
         $right = count($height) - 1;
         $maxArea = 0;
 
         while ($left < $right) {
-
             $area = min($height[$left], $height[$right]) * ($right - $left);
 
             $maxArea = max($maxArea, $area);
diff --git a/solution/0000-0099/0012.Integer to Roman/README.md b/solution/0000-0099/0012.Integer to Roman/README.md
index 23501e8b23db8..1002a00bb1425 100644
--- a/solution/0000-0099/0012.Integer to Roman/README.md	
+++ b/solution/0000-0099/0012.Integer to Roman/README.md	
@@ -182,15 +182,13 @@ public class Solution {
 ```
 
 ```php
-class Solution
-{
+class Solution {
     /**
      * @param int $num
      * @return string
      */
 
-    function intToRoman($num)
-    {
+    function intToRoman($num) {
         $values = [
             'M' => 1000,
             'CM' => 900,
diff --git a/solution/0000-0099/0012.Integer to Roman/README_EN.md b/solution/0000-0099/0012.Integer to Roman/README_EN.md
index 6519e6941420d..5d2bbfa90b174 100644
--- a/solution/0000-0099/0012.Integer to Roman/README_EN.md	
+++ b/solution/0000-0099/0012.Integer to Roman/README_EN.md	
@@ -169,15 +169,13 @@ public class Solution {
 ```
 
 ```php
-class Solution
-{
+class Solution {
     /**
      * @param int $num
      * @return string
      */
 
-    function intToRoman($num)
-    {
+    function intToRoman($num) {
         $values = [
             'M' => 1000,
             'CM' => 900,

From d79fef4c749a40f7b0679c8e0f4e9b9e35e2a36e Mon Sep 17 00:00:00 2001
From: Libin YANG <contact@yanglibin.info>
Date: Wed, 21 Feb 2024 09:25:13 +0800
Subject: [PATCH 3/6] Update Solution.php

---
 .../0000-0099/0011.Container With Most Water/Solution.php  | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/solution/0000-0099/0011.Container With Most Water/Solution.php b/solution/0000-0099/0011.Container With Most Water/Solution.php
index 7e4025b882e21..320347510d2fa 100644
--- a/solution/0000-0099/0011.Container With Most Water/Solution.php	
+++ b/solution/0000-0099/0011.Container With Most Water/Solution.php	
@@ -1,18 +1,15 @@
-class Solution
-{
+class Solution {
     /**
      * @param int[] $height
      * @return int
      */
 
-    function maxArea($height)
-    {
+    function maxArea($height) {
         $left = 0;
         $right = count($height) - 1;
         $maxArea = 0;
 
         while ($left < $right) {
-
             $area = min($height[$left], $height[$right]) * ($right - $left);
 
             $maxArea = max($maxArea, $area);

From e19bac3a5edbd54980de93c37c9d151b9809db09 Mon Sep 17 00:00:00 2001
From: Libin YANG <contact@yanglibin.info>
Date: Wed, 21 Feb 2024 09:25:57 +0800
Subject: [PATCH 4/6] Update Solution.php

---
 solution/0000-0099/0012.Integer to Roman/Solution.php | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/solution/0000-0099/0012.Integer to Roman/Solution.php b/solution/0000-0099/0012.Integer to Roman/Solution.php
index a6106716d5b81..1f0523d2f333b 100644
--- a/solution/0000-0099/0012.Integer to Roman/Solution.php	
+++ b/solution/0000-0099/0012.Integer to Roman/Solution.php	
@@ -1,12 +1,10 @@
-class Solution
-{
+class Solution {
     /**
      * @param int $num
      * @return string
      */
 
-    function intToRoman($num)
-    {
+    function intToRoman($num) {
         $values = [
             'M' => 1000,
             'CM' => 900,

From f773dba398efc6a168eab4d428de47bcaeb3bf36 Mon Sep 17 00:00:00 2001
From: ZylalMinollari <zmiollari@gmail.com>
Date: Thu, 4 Apr 2024 12:46:04 +0200
Subject: [PATCH 5/6] PHP solution for problems 31-35

---
 .../0000-0099/0031.Next Permutation/README.md | 38 +++++++++++++++++++
 .../0031.Next Permutation/README_EN.md        | 38 +++++++++++++++++++
 .../0031.Next Permutation/Solution.php        | 35 +++++++++++++++++
 .../0032.Longest Valid Parentheses/README.md  | 31 +++++++++++++++
 .../README_EN.md                              | 31 +++++++++++++++
 .../Solution.php                              | 28 ++++++++++++++
 .../README.md                                 | 20 ++++++++++
 .../README_EN.md                              | 20 ++++++++++
 .../Solution.php                              | 17 +++++++++
 .../README.md                                 | 27 +++++++++++++
 .../README_EN.md                              | 27 +++++++++++++
 .../Solution.php                              | 24 ++++++++++++
 .../0035.Search Insert Position/README.md     | 21 ++++++++++
 .../0035.Search Insert Position/README_EN.md  | 21 ++++++++++
 .../0035.Search Insert Position/Solution.php  | 18 +++++++++
 15 files changed, 396 insertions(+)
 create mode 100644 solution/0000-0099/0031.Next Permutation/Solution.php
 create mode 100644 solution/0000-0099/0032.Longest Valid Parentheses/Solution.php
 create mode 100644 solution/0000-0099/0033.Search in Rotated Sorted Array/Solution.php
 create mode 100644 solution/0000-0099/0034.Find First and Last Position of Element in Sorted Array/Solution.php
 create mode 100644 solution/0000-0099/0035.Search Insert Position/Solution.php

diff --git a/solution/0000-0099/0031.Next Permutation/README.md b/solution/0000-0099/0031.Next Permutation/README.md
index ac1b3ee682867..deae247ce0f21 100644
--- a/solution/0000-0099/0031.Next Permutation/README.md	
+++ b/solution/0000-0099/0031.Next Permutation/README.md	
@@ -229,6 +229,44 @@ public class Solution {
 }
 ```
 
+```php
+class Solution {
+
+    /**
+     * @param integer[] $nums
+     * @return void
+     */
+
+    function nextPermutation(&$nums) {
+        $n = count($nums);
+        $i = $n - 2;
+        while ($i >= 0 && $nums[$i] >= $nums[$i + 1]) {
+            $i--;
+        }
+        if ($i >= 0) {
+            $j = $n - 1;
+            while ($j >= $i && $nums[$j] <= $nums[$i]) {
+                $j--;
+            }
+            $temp = $nums[$i];
+            $nums[$i] = $nums[$j];
+            $nums[$j] = $temp;
+        }
+        $this->reverse($nums, $i + 1, $n - 1);
+    }
+
+    function reverse(&$nums, $start, $end) {
+        while ($start < $end) {
+            $temp = $nums[$start];
+            $nums[$start] = $nums[$end];
+            $nums[$end] = $temp;
+            $start++;
+            $end--;
+        }
+    }
+}
+```
+
 <!-- tabs:end -->
 
 <!-- end -->
diff --git a/solution/0000-0099/0031.Next Permutation/README_EN.md b/solution/0000-0099/0031.Next Permutation/README_EN.md
index 0d17341445196..84e0a4d9653fe 100644
--- a/solution/0000-0099/0031.Next Permutation/README_EN.md	
+++ b/solution/0000-0099/0031.Next Permutation/README_EN.md	
@@ -225,6 +225,44 @@ public class Solution {
 }
 ```
 
+```php
+class Solution {
+
+    /**
+     * @param integer[] $nums
+     * @return void
+     */
+
+    function nextPermutation(&$nums) {
+        $n = count($nums);
+        $i = $n - 2;
+        while ($i >= 0 && $nums[$i] >= $nums[$i + 1]) {
+            $i--;
+        }
+        if ($i >= 0) {
+            $j = $n - 1;
+            while ($j >= $i && $nums[$j] <= $nums[$i]) {
+                $j--;
+            }
+            $temp = $nums[$i];
+            $nums[$i] = $nums[$j];
+            $nums[$j] = $temp;
+        }
+        $this->reverse($nums, $i + 1, $n - 1);
+    }
+
+    function reverse(&$nums, $start, $end) {
+        while ($start < $end) {
+            $temp = $nums[$start];
+            $nums[$start] = $nums[$end];
+            $nums[$end] = $temp;
+            $start++;
+            $end--;
+        }
+    }
+}
+```
+
 <!-- tabs:end -->
 
 <!-- end -->
diff --git a/solution/0000-0099/0031.Next Permutation/Solution.php b/solution/0000-0099/0031.Next Permutation/Solution.php
new file mode 100644
index 0000000000000..d89a03a7e10cc
--- /dev/null
+++ b/solution/0000-0099/0031.Next Permutation/Solution.php	
@@ -0,0 +1,35 @@
+class Solution {
+
+    /**
+     * @param integer[] $nums
+     * @return void
+     */
+
+    function nextPermutation(&$nums) {
+        $n = count($nums);
+        $i = $n - 2;
+        while ($i >= 0 && $nums[$i] >= $nums[$i + 1]) {
+            $i--;
+        }
+        if ($i >= 0) {
+            $j = $n - 1;
+            while ($j >= $i && $nums[$j] <= $nums[$i]) {
+                $j--;
+            }
+            $temp = $nums[$i];
+            $nums[$i] = $nums[$j];
+            $nums[$j] = $temp;
+        }
+        $this->reverse($nums, $i + 1, $n - 1);
+    }
+
+    function reverse(&$nums, $start, $end) {
+        while ($start < $end) {
+            $temp = $nums[$start];
+            $nums[$start] = $nums[$end];
+            $nums[$end] = $temp;
+            $start++;
+            $end--;
+        }
+    }
+}
diff --git a/solution/0000-0099/0032.Longest Valid Parentheses/README.md b/solution/0000-0099/0032.Longest Valid Parentheses/README.md
index a6b24aec41d7e..720ffebe29a6c 100644
--- a/solution/0000-0099/0032.Longest Valid Parentheses/README.md	
+++ b/solution/0000-0099/0032.Longest Valid Parentheses/README.md	
@@ -385,6 +385,37 @@ var longestValidParentheses = function (s) {
 };
 ```
 
+```php
+class Solution {
+    /**
+     * @param string $s
+     * @return integer
+     */
+
+    function longestValidParentheses($s) {
+        $stack = [];
+        $maxLength = 0;
+
+        array_push($stack, -1);
+        for ($i = 0; $i < strlen($s); $i++) {
+            if ($s[$i] === '(') {
+                array_push($stack, $i);
+            } else {
+                array_pop($stack);
+
+                if (empty($stack)) {
+                    array_push($stack, $i);
+                } else {
+                    $length = $i - end($stack);
+                    $maxLength = max($maxLength, $length);
+                }
+            }
+        }
+        return $maxLength;
+    }
+}
+```
+
 <!-- tabs:end -->
 
 <!-- end -->
diff --git a/solution/0000-0099/0032.Longest Valid Parentheses/README_EN.md b/solution/0000-0099/0032.Longest Valid Parentheses/README_EN.md
index 50c74daaf5a0e..4af17bd5fa483 100644
--- a/solution/0000-0099/0032.Longest Valid Parentheses/README_EN.md	
+++ b/solution/0000-0099/0032.Longest Valid Parentheses/README_EN.md	
@@ -382,6 +382,37 @@ var longestValidParentheses = function (s) {
 };
 ```
 
+```php
+class Solution {
+    /**
+     * @param string $s
+     * @return integer
+     */
+
+    function longestValidParentheses($s) {
+        $stack = [];
+        $maxLength = 0;
+
+        array_push($stack, -1);
+        for ($i = 0; $i < strlen($s); $i++) {
+            if ($s[$i] === '(') {
+                array_push($stack, $i);
+            } else {
+                array_pop($stack);
+
+                if (empty($stack)) {
+                    array_push($stack, $i);
+                } else {
+                    $length = $i - end($stack);
+                    $maxLength = max($maxLength, $length);
+                }
+            }
+        }
+        return $maxLength;
+    }
+}
+```
+
 <!-- tabs:end -->
 
 <!-- end -->
diff --git a/solution/0000-0099/0032.Longest Valid Parentheses/Solution.php b/solution/0000-0099/0032.Longest Valid Parentheses/Solution.php
new file mode 100644
index 0000000000000..61b4858a7144c
--- /dev/null
+++ b/solution/0000-0099/0032.Longest Valid Parentheses/Solution.php	
@@ -0,0 +1,28 @@
+class Solution {
+    /**
+     * @param string $s
+     * @return integer
+     */
+
+    function longestValidParentheses($s) {
+        $stack = [];
+        $maxLength = 0;
+
+        array_push($stack, -1);
+        for ($i = 0; $i < strlen($s); $i++) {
+            if ($s[$i] === '(') {
+                array_push($stack, $i);
+            } else {
+                array_pop($stack);
+
+                if (empty($stack)) {
+                    array_push($stack, $i);
+                } else {
+                    $length = $i - end($stack);
+                    $maxLength = max($maxLength, $length);
+                }
+            }
+        }
+        return $maxLength;
+    }
+}
diff --git a/solution/0000-0099/0033.Search in Rotated Sorted Array/README.md b/solution/0000-0099/0033.Search in Rotated Sorted Array/README.md
index eba73e73bcb53..cee88c22bd948 100644
--- a/solution/0000-0099/0033.Search in Rotated Sorted Array/README.md	
+++ b/solution/0000-0099/0033.Search in Rotated Sorted Array/README.md	
@@ -254,6 +254,26 @@ var search = function (nums, target) {
 };
 ```
 
+```php
+class Solution {
+    /**
+     * @param integer[] $nums
+     * @param integer $target
+     * @return integer
+     */
+
+    function search($nums, $target) {
+        $foundKey = -1;
+        foreach ($nums as $key => $value) {
+            if ($value === $target) {
+                $foundKey = $key;
+            }
+        }
+        return $foundKey;
+    }
+}
+```
+
 <!-- tabs:end -->
 
 <!-- end -->
diff --git a/solution/0000-0099/0033.Search in Rotated Sorted Array/README_EN.md b/solution/0000-0099/0033.Search in Rotated Sorted Array/README_EN.md
index 844d266dc3870..eaddd092189ce 100644
--- a/solution/0000-0099/0033.Search in Rotated Sorted Array/README_EN.md	
+++ b/solution/0000-0099/0033.Search in Rotated Sorted Array/README_EN.md	
@@ -240,6 +240,26 @@ var search = function (nums, target) {
 };
 ```
 
+```php
+class Solution {
+    /**
+     * @param integer[] $nums
+     * @param integer $target
+     * @return integer
+     */
+
+    function search($nums, $target) {
+        $foundKey = -1;
+        foreach ($nums as $key => $value) {
+            if ($value === $target) {
+                $foundKey = $key;
+            }
+        }
+        return $foundKey;
+    }
+}
+```
+
 <!-- tabs:end -->
 
 <!-- end -->
diff --git a/solution/0000-0099/0033.Search in Rotated Sorted Array/Solution.php b/solution/0000-0099/0033.Search in Rotated Sorted Array/Solution.php
new file mode 100644
index 0000000000000..b52820a83ccf1
--- /dev/null
+++ b/solution/0000-0099/0033.Search in Rotated Sorted Array/Solution.php	
@@ -0,0 +1,17 @@
+class Solution {
+    /**
+     * @param integer[] $nums
+     * @param integer $target
+     * @return integer
+     */
+
+    function search($nums, $target) {
+        $foundKey = -1;
+        foreach ($nums as $key => $value) {
+            if ($value === $target) {
+                $foundKey = $key;
+            }
+        }
+        return $foundKey;
+    }
+}
diff --git a/solution/0000-0099/0034.Find First and Last Position of Element in Sorted Array/README.md b/solution/0000-0099/0034.Find First and Last Position of Element in Sorted Array/README.md
index 261842e7f5795..862a7dcf985fa 100644
--- a/solution/0000-0099/0034.Find First and Last Position of Element in Sorted Array/README.md	
+++ b/solution/0000-0099/0034.Find First and Last Position of Element in Sorted Array/README.md	
@@ -233,6 +233,33 @@ var searchRange = function (nums, target) {
 };
 ```
 
+```php
+class Solution {
+    /**
+     * @param integer[] $nums
+     * @param integer $target
+     * @return integer[]
+     */
+
+    function searchRange($nums, $target) {
+        $min = -1;
+        $max = -1;
+        foreach ($nums as $key => $value) {
+            if ($value == $target) {
+                if ($min == -1) {
+                    $min = $key;
+                }
+
+                if ($key > $max) {
+                    $max = $key;
+                }
+            }
+        }
+        return [$min, $max];
+    }
+}
+```
+
 <!-- tabs:end -->
 
 <!-- end -->
diff --git a/solution/0000-0099/0034.Find First and Last Position of Element in Sorted Array/README_EN.md b/solution/0000-0099/0034.Find First and Last Position of Element in Sorted Array/README_EN.md
index 291e92949d9b3..318c94ccae03f 100644
--- a/solution/0000-0099/0034.Find First and Last Position of Element in Sorted Array/README_EN.md	
+++ b/solution/0000-0099/0034.Find First and Last Position of Element in Sorted Array/README_EN.md	
@@ -221,6 +221,33 @@ var searchRange = function (nums, target) {
 };
 ```
 
+```php
+class Solution {
+    /**
+     * @param integer[] $nums
+     * @param integer $target
+     * @return integer[]
+     */
+
+    function searchRange($nums, $target) {
+        $min = -1;
+        $max = -1;
+        foreach ($nums as $key => $value) {
+            if ($value == $target) {
+                if ($min == -1) {
+                    $min = $key;
+                }
+
+                if ($key > $max) {
+                    $max = $key;
+                }
+            }
+        }
+        return [$min, $max];
+    }
+}
+```
+
 <!-- tabs:end -->
 
 <!-- end -->
diff --git a/solution/0000-0099/0034.Find First and Last Position of Element in Sorted Array/Solution.php b/solution/0000-0099/0034.Find First and Last Position of Element in Sorted Array/Solution.php
new file mode 100644
index 0000000000000..fb999bb94eec3
--- /dev/null
+++ b/solution/0000-0099/0034.Find First and Last Position of Element in Sorted Array/Solution.php	
@@ -0,0 +1,24 @@
+class Solution {
+    /**
+     * @param integer[] $nums
+     * @param integer $target
+     * @return integer[]
+     */
+
+    function searchRange($nums, $target) {
+        $min = -1;
+        $max = -1;
+        foreach ($nums as $key => $value) {
+            if ($value == $target) {
+                if ($min == -1) {
+                    $min = $key;
+                }
+
+                if ($key > $max) {
+                    $max = $key;
+                }
+            }
+        }
+        return [$min, $max];
+    }
+}
diff --git a/solution/0000-0099/0035.Search Insert Position/README.md b/solution/0000-0099/0035.Search Insert Position/README.md
index 82642cde9ea99..a9c3b20636c00 100644
--- a/solution/0000-0099/0035.Search Insert Position/README.md	
+++ b/solution/0000-0099/0035.Search Insert Position/README.md	
@@ -204,6 +204,27 @@ func searchInsert(nums []int, target int) int {
 }
 ```
 
+```php
+class Solution {
+    /**
+     * @param integer[] $nums
+     * @param integer $target
+     * @return integer
+     */
+
+    function searchInsert($nums, $target) {
+        $key = array_search($target, $nums);
+        if ($key !== false) {
+            return $key;
+        }
+
+        $nums[] = $target;
+        sort($nums);
+        return array_search($target, $nums);
+    }
+}
+```
+
 <!-- tabs:end -->
 
 <!-- end -->
diff --git a/solution/0000-0099/0035.Search Insert Position/README_EN.md b/solution/0000-0099/0035.Search Insert Position/README_EN.md
index e2f68d799a720..4c64307e3704b 100644
--- a/solution/0000-0099/0035.Search Insert Position/README_EN.md	
+++ b/solution/0000-0099/0035.Search Insert Position/README_EN.md	
@@ -200,6 +200,27 @@ func searchInsert(nums []int, target int) int {
 }
 ```
 
+```php
+class Solution {
+    /**
+     * @param integer[] $nums
+     * @param integer $target
+     * @return integer
+     */
+
+    function searchInsert($nums, $target) {
+        $key = array_search($target, $nums);
+        if ($key !== false) {
+            return $key;
+        }
+
+        $nums[] = $target;
+        sort($nums);
+        return array_search($target, $nums);
+    }
+}
+```
+
 <!-- tabs:end -->
 
 <!-- end -->
diff --git a/solution/0000-0099/0035.Search Insert Position/Solution.php b/solution/0000-0099/0035.Search Insert Position/Solution.php
new file mode 100644
index 0000000000000..6290cc266dc52
--- /dev/null
+++ b/solution/0000-0099/0035.Search Insert Position/Solution.php	
@@ -0,0 +1,18 @@
+class Solution {
+    /**
+     * @param integer[] $nums
+     * @param integer $target
+     * @return integer
+     */
+
+    function searchInsert($nums, $target) {
+        $key = array_search($target, $nums);
+        if ($key !== false) {
+            return $key;
+        }
+
+        $nums[] = $target;
+        sort($nums);
+        return array_search($target, $nums);
+    }
+}

From 68c38e3cd67ac0e726016d5cf1402237c0aae13d Mon Sep 17 00:00:00 2001
From: ZylalMinollari <ZylalMinollari@users.noreply.github.com>
Date: Thu, 4 Apr 2024 10:51:38 +0000
Subject: [PATCH 6/6] style: format code and docs with prettier

---
 solution/0000-0099/0031.Next Permutation/README.md    | 1 -
 solution/0000-0099/0031.Next Permutation/README_EN.md | 1 -
 2 files changed, 2 deletions(-)

diff --git a/solution/0000-0099/0031.Next Permutation/README.md b/solution/0000-0099/0031.Next Permutation/README.md
index deae247ce0f21..e04ce4a954bfb 100644
--- a/solution/0000-0099/0031.Next Permutation/README.md	
+++ b/solution/0000-0099/0031.Next Permutation/README.md	
@@ -231,7 +231,6 @@ public class Solution {
 
 ```php
 class Solution {
-
     /**
      * @param integer[] $nums
      * @return void
diff --git a/solution/0000-0099/0031.Next Permutation/README_EN.md b/solution/0000-0099/0031.Next Permutation/README_EN.md
index 84e0a4d9653fe..1127774a06b9e 100644
--- a/solution/0000-0099/0031.Next Permutation/README_EN.md	
+++ b/solution/0000-0099/0031.Next Permutation/README_EN.md	
@@ -227,7 +227,6 @@ public class Solution {
 
 ```php
 class Solution {
-
     /**
      * @param integer[] $nums
      * @return void