First uppercase letter in a string ( Iterative and Recursive ) | Function to find string which has first character of each word . ; Driver code
< ? php function first ( $ str ) { for ( $ i = 0 ; $ i < strlen ( $ str ) ; $ i ++ ) if ( ctype_upper ( $ str [ $ i ] ) ) { return $ str [ $ i ] ; } return 0 ; } $ str = " geeksforGeeKS " ; $ res = first ( $ str ) ; if ( ord ( $ res ) == ord ( 0 ) ) echo " No ▁ uppercase ▁ letter " ; else echo $ res . " STRNEWLINE " ; ? >