Check if mirror image of a number is same if displayed in seven segment display | Return " Yes " , if the mirror image of number is same as the given number Else return " No " ; Checking if the number contain only 0 , 1 , 8. ; Checking if the number is palindrome or not . ; If corresponding index is not equal . ; Driver Code
< ? php function checkEqual ( $ S ) { for ( $ i = 0 ; $ i < strlen ( $ S ) ; $ i ++ ) { if ( $ S [ $ i ] != '1' && $ S [ $ i ] != '0' && $ S [ $ i ] != '8' ) { return " No " ; } } $ start = 0 ; $ end = strlen ( $ S ) - 1 ; while ( $ start < $ end ) { if ( $ S [ $ start ] != $ S [ $ end ] ) { return " No " ; } $ start ++ ; $ end -- ; } return " Yes " ; } $ S = "101" ; echo checkEqual ( $ S ) ; ? >