relatively odd php application

Discussion in 'Programming/Scripts' started by rodobrist, Dec 14, 2010.

  1. rodobrist

    rodobrist New Member

    hey guys im using a csv parser in php that will break every cell up into its individual words, then

    Code:
    $cell[$word]['clean']=trim($cell[$word]['raw']);
    ($word is a number btw, between 0 and length-1 of cell, this should be familiar territory)

    now I wanted to cycle through every letter of the word (did this using implode) so that the letters are now array form, and here is my pickle.

    Code:
    	switch (true){				
    	
    		case $l==0:		//first letter switch
    			switch (true){
    				case ctype_upper($cell[$w-1][$l]) || ctype_upper($cell[$w+1][$l]):	//Title Typing You Get It
    					break;
    				case $w==0 && !ctype_upper($cell[$w+1][$l]):						//FIRST IN CELL- the && protects from both being true
    					break;
    				case !ctype_upper($cell[$w-1][$l])&&$cell[$w-1][strlen($cell[$w-1]['raw'])-1]!='.':	//OUT OF PLACE -- no fullstop and no caps in word before
    					break;
    			}
    
    the first case is the case that is causing me problems, im getting an error thrown back at me if the word is either the first or last word in the cell (ie $w-1 or $w+1) does not exist.

    i tried using @ but it does not work in conditionals, i understand that i could use a complicated combination of isset and deeper switch nesting, but im hoping someone knows about some type of @ for switch statements
     
    Last edited: Dec 14, 2010
  2. rodobrist

    rodobrist New Member

    I have been given a deeper insight about the @ symbol and my hopeful solution does not exist, please don't spend any time of this thread, if I could delete it I would.
     

Share This Page