[PHP] javascript cookie dissapears when adding session_start()

2013-03-20 Thread Norah Jones
I've been working on a PHP/Javascript Cookie Notify (Including multiple 
language support). Now I have one small problem, when session_start() is not at 
the top, the cookie message works as it should be. 
Now I am trying to add session_start(); at the top, as this will load the 
current language file the visitor has set it to. But then the cookie message 
will not show.
I've cleaned all my cookies, and still can't get it to work ...
I've put up a small code on jsFiddle, but when session_start(); is at the top, 
it launches correctly in jsFiddle. which can be viewed (here).
Does anyone know what i'm doing wrong? And would you be able to explain me what 
I am doing wrong?

Thanks



[PHP] significance of escape character in string in PHP

2013-03-18 Thread Norah Jones
I am having an string which was have few ' (single quote) and few  (double 
quotes) and was not able to insert into the mysql database. I have replaced 
them with \' and \ and everything is fine.
Though this are fine now but don't understand the working and I could have 
missed few corner cases also. Please suggest the working and also if there is 
some better way to achieve this.



Re: [PHP] Type of a variable in PHP

2013-03-16 Thread Norah Jones
Try this

function get_type($var)
{
if(is_object($var))
return get_class($var);
if(is_null($var))
return 'null';
if(is_string($var))
return 'string';
if(is_array($var))
return 'array';
if(is_int($var))
return 'integer';
if(is_bool($var))
return 'boolean';
if(is_float($var))
return 'float';
if(is_resource($var))
return 'resource';
//throw new NotImplementedException();
return 'unknown';
}



On Fri, Mar 15, 2013 at 3:28 PM, Karim Geiger gei...@b1-systems.de wrote:

 Hi,

 On Fri, 2013-03-15 at 09:55 +, Kevin Peterson wrote:
  Have two questions -
  1. How to find type of a variable in PHP.
  2. How to find the type of an array in PHP.
 
  Please help.
 

 Use this:
 http://php.net/manual/en/function.gettype.php

 Regards

 Karim

 --
 Karim Geiger

 B1 Systems GmbH
 Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
 GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537



[PHP] How can I make PHP CodeSniffer Fixer ignore the namespace declaration?

2013-03-12 Thread Norah Jones
I am using the sublime text 2 plugin for PHP Coding Standards Fixer. It is 
working fine, except for the fact that it considers the namespace invalid (it 
is in fact invalid and I'm okay with it). this errors halts the script from 
correcting the rest of the file. I get the following error:


The namespace Application\Controllers\Admin in  does not match the file 
path according to PSR-0 rules.

How can I tell the the script to ignore the namespace constraint. Both command 
line arguments and Sublime text 2 user settings can be changed.