G
G
Glory2021-06-20 00:42:38
Regular Expressions
Glory, 2021-06-20 00:42:38

How can I write a regular expression that would be from the string $key = 'value'; pulled out what could be where value is?

There is a php configuration file. It has keys and values. How do I know the keys to pull out the value? For example,

$database_user = 'root';
$database_server = 'localhost';


Here I need regular expressions, which, when receiving the name of the key, would receive its value. In this case, there can be spaces or tabs between the name of the key and the value and equal signs. But you need to get what is in single quotes.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question