Asked  2 Years ago    Answers:  5   Viewed   89 times

I have used create_function in my application below.

$callbacks[$delimiter] = create_function('$matches', "return '$delimiter' . strtolower($matches[1]);");

But for PHP 7.2.0, the create_function() is deprecated.

Any idea, how to fix my codes above on PHP 7.2.0.

Thanks for your help,

 Answers

2

You should be able to use an Anonymous Function (aka Closure) with a call to the parent scoped $delimiter variable, like so:

$callbacks[$delimiter] = function($matches) use ($delimiter) {
    return $delimiter . strtolower($matches[1]);
};
Thursday, September 15, 2022
1

You should point to your vendor/autoload.php at Settings | PHP | PHPUnit when using PHPUnit via Composer.

This blog post has all the details (with pictures) to successfully configure IDE for such scenario: http://confluence.jetbrains.com/display/PhpStorm/PHPUnit+Installation+via+Composer+in+PhpStorm

Related usability ticket: http://youtrack.jetbrains.com/issue/WI-18388

P.S. The WI-18388 ticket is already fixed in v8.0

Sunday, July 31, 2022
 
4

On Mac OS X environment variables available in Terminal and for the normal applications can be different, check the related question for the solution how to make them similar.

Note that this solution will not work on Mountain Lion (10.8).

Sunday, November 6, 2022
5

add these code into the top of your script

@set_magic_quotes_runtime(false);
ini_set('magic_quotes_runtime', 0);
Friday, August 26, 2022
 
alinoor
 
2

You must use preg_match instead of ereg because the last one is deprecated.

Replacing it is not a big deal:

ereg( "[][{}()*+?.\^$|]", $_REQUEST['name'] )

will become:

preg_match( "/[][{}()*+?.\^$|]/", $_REQUEST['name'] )

p.s. I had to modify more than one hundred files while I was porting my old project to PHP 5.3 to avoid manually modifying I've used following script to do it for me:

function replaceEregWithPregMatch($path) {
    $content = file_get_contents($path);
    $content = preg_replace('/ereg(("|')(.+)("|'),/',
                            "preg_match('/$2/',",
                            $content);
    file_put_contents($path, $content);
}

I hope it helps.

Wednesday, August 10, 2022
 
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :
 

Browse Other Code Languages