txt = "Hello, World!" # 2. Characters from index 2 to 5 print(txt[2:6]) # 3. Convert to uppercase print(txt.upper()) # 4. Create name variable name = "Python" # 5. f-string print(f"I love {name}")
Code Challenge : Create a PHP function to find the intersection of two arrays - FirstDue Interview Questions
This was the client round question for code challenge.. Create a PHP function to find the intersection of two arrays. <?php function FindIntersection ( $strArr ) { // Split the strings into arrays and convert to integers foreach ( $strArr as $index => $element ) { $strArr [ $index ] = array_map ( 'intval' , explode ( ',' , $element )); } $main_match_array = $strArr [ 0 ]; array_shift ( $strArr ); $interarray = []; foreach ( $strArr as $each_chunk ) { foreach ( $main_match_array as $in => $number ) { if ( in_array ( $number , $each_chunk )) { $interarray [ $number ] = $number ; } else { unset ( $int...