'Preg_match function in PHP 8.1 does not work properly
I am using the preg_match function in PHP 8.1, but unfortunately, this function does not give me any output. I am looking for @extends('admin.layouts.app') in my strings and using the preg_match() function as follows.
$filePathArray = [];
preg_match("/s*@extends+\('([^)]+)'\)/", $this->content, $filePathArray);
return isset($filePathArray[1]) ? $filePathArray[1] : false;
This problem exists in PHP 8.1 and not in PHP 7.4, which I tested; I also checked the function online on various regex testers and had no issues.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
