Here's a PHP code snippet to find the first non-repeating character in a string: <?php function firstNonRepeatingCharacter($str) { $charCount = array(); // Count occurrences of each character in the string for ($i = 0; $i < strlen($str); $i++) { $char = $str[$i]; if (isset($charCount[$char])) { $charCount[$char]++; } else { $charCount[$char] = 1; } } // Find the first non-repeating character for ($i = 0; $i < strlen($str); $i++) { $char = $str[$i]; if ($charCount[$char] === 1) { return $char; } } // If no non-repeating character is found ...
Prepare for your next job!! PHP,LARAVEL,MYSQL,VUEJS,React Js, AWS...lot more