Asked  7 Months ago    Answers:  5   Viewed   46 times

Possible Duplicate:
Writing a function in php

I'm using the following code

echo 'Curl: ', function_exists('curl_version') ? 'Enabled' : 'Disabled';

this can get it enabled or disabled

but I would like to make as function say function name is _iscurl

then I can call it as following any where in my website code

if (_iscurl()){
  echo "this is enabled"; // will do an action
}else{
  echo "this is disabled"; // will do another action
}

almost same as my previous question check if allow_url_fopen is enabled or not

 Answers

52

Just return your existing check from a function.

function _isCurl(){
    return function_exists('curl_version');
}
Wednesday, March 31, 2021
 
SpiderLinked
answered 7 Months ago
86

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

Wednesday, March 31, 2021
 
ojrac
answered 7 Months ago
79

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).

Saturday, May 29, 2021
 
Nate
answered 5 Months ago
47

Use ini_get() to get the value of certain configuration parameters:

if( ini_get('allow_url_fopen') ) {
   // lucky me...
} 
Sunday, July 4, 2021
 
HamidR
answered 4 Months ago
31
ApplicationInfo ai = 
               getActivity().getPackageManager().getApplicationInfo("your_package",0);

boolean appStatus = ai.enabled;

Thanks to Amir

Sunday, August 1, 2021
 
ericstumper
answered 3 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :