Converting INI To Mysql in an easier way.
#1

Well, recently I thought to update my old script to mysql, what I thought to do was
PHP код:
stock INI_Int(What[],Variable)
{
    
Variable cache_get_field_content_int(0What);

Would this work? I guess it'll.
Reply
#2

It won't do anything because the variable isn't passed by reference. That means it needs to be preceded with an ampersand symbol (&) in the function header.

However, wouldn't it be far simpler to perform a search-and-replace? I think it's worthwhile to learn about regular expressions because there are lots of cases where these are useful. For instance, you can replace all INI_Int lines using a regular expression like so:

Search:
Код:
INI_Int\((.+?),\s?(.+?)\)
Replace:
Код:
$2 = cache_get_field_content_int\(0, $1\)
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
It won't do anything because the variable isn't passed by reference. That means it needs to be preceded with an ampersand symbol (&) in the function header.

However, wouldn't it be far simpler to perform a search-and-replace? I think it's worthwhile to learn about regular expressions because there are lots of cases where these are useful. For instance, you can replace all INI_Int lines using a regular expression like so:

Search:
Код:
INI_Int\((.+?),\s?(.+?)\)
Replace:
Код:
$2 = cache_get_field_content_int\(0, $1\)
Seems like I got something new to learn, thanks for the information, cheers! Where can I learn more about it? And about that search and replace too.
Reply
#4

I always use regexr.com to test. The menu on the left hand side has full reference about all the different specifiers.
Reply
#5

Quote:
Originally Posted by Vince
Посмотреть сообщение
I always use regexr.com to test. The menu on the left hand side has full reference about all the different specifiers.
Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)