9 's complement of a decimal number | PHP program to find 9 's complement of a number. ; Driver code
< ? php function complement ( $ number ) { for ( $ i = 0 ; $ i < strlen ( $ number ) ; $ i ++ ) if ( $ number [ $ i ] != ' . ' ) $ number [ $ i ] = '9' - $ number [ $ i ] + '0' ; echo "9 ' s ▁ complement ▁ is ▁ : ▁ " , $ number ; } $ number = "345.45" ; complement ( $ number ) ; ? >