Sometimes you need to convert a json string to CSV in PHP. For example we want to get the names Norrmalm and Liljeholmen (cities names at Sweden) from the following json string: ‘{“Norrmalm”:”502″,”Liljeholmen”:”491″}’; Here is the simplest solution: $jsonStr='{“Norrmalm”:”502″,”Liljeholmen”:”491″}’; $csv = str_replace(array(‘[‘,’]’), ”, json_encode(array_keys(json_decode($jsonStr, true)))) echo $csv; It will print out : “Norrmalm”,”Liljeholmen” How it

When you create PHPUnit tests for your models in Yii using netbeans you may encounter this problem PHP Fatal error: Class ‘CActiveRecord’ not found.. The easiest solution is to include the following at the top of the model class, for example if the class is User then your code should look like $yii=’/opt/lampp/htdocs/yii/framework/yii.php’; require_once($yii); class

In my previous post I demonstrated how to install Yii Rights extension easily and quickly. We commented out the code for checking superuser given below. Now to address this issue simply edit file /modules/rights/components/RAuthorizer.php and comment out the lines near line no 304 and 305. //if( $superusers===array() ) // throw new CHttpException(403, Rights::t(‘core’, ‘There must

When you make the user login to your website via a social network like facebook and the user is directed by CHybridAuth to the social network (facebook). Then the user has two choices to either allow or cancel the access to your app. If the user happens to cancel the access then the class Endpoint

On the server The server configuration is the following. 1. Download the portable version of msysgit (from: and extract it to C:\Git. 2. Add C:\Git\bin to the PATH variable. (If you don’t want to use the portable msysgit for whatever reason, you also have to add C:\Git\libexec\git-core to the PATH) 3. Create a new