########################################## # # PHP (2): In class exercise # ########################################## #################################################### # ALL OF THE FILES SHOULD BE SAVED AS .php # Try to add enough comments in your code. #################################################### ###### Question No. 1 ################################################## #################################################### # # Consider you have the following text: $24,555.00 # # Use the appropriate string manipulation # commands to change it to : 24,555 # # Tip: Use the trim command # #################################################### ###### Question No. 2 ################################################## #################################################### # # Consider you have the following text: $24,555.00 # # Use the appropriate string manipulation # commands to change it to : $24,555 # # Tip: Use the rtrim command # #################################################### ###### Question No. 3 ################################################## #################################################### # # Consider you have the following text: HELLO WORLD! # # Use the appropriate string manipulation # commands to change it to : Hello World! # # Tip: Use the ucwords command # #################################################### ###### Question No. 4 ################################################## #################################################### # # Consider you have an array consisting of the # following elements: peter, mark and robin # # Try to change the array to: Peter, Mark and Robin # # Tip: Use the ucfirst command # #################################################### ###### Question No. 5 ################################################## #################################################### # # Consider you have an array consisting of the # following elements: Peter, 48 and Halifax # # Try to change the array to a string containing: # Peter/48/Halifax # # Tip: Use the impolde command # #################################################### ###### Question No. 6 ################################################## #################################################### # # Consider you have the following text: $24,555.00 # # Use the appropriate string manipulation # commands to change it to : 24555 # # Tip: Use the substr command # #################################################### ###### Question No. 7 ################################################## #################################################### # # Show how much is the length of the folowing # string: "The lab information is ready." # # Tip: Use the strlen command # #################################################### ###### Question No. 8 ################################################## #################################################### # # Consider you have the following text: # "%pname% is diagnosed with %disease%. %pname% will # get blood packs in order to improve his %disease%." # # Use the appropriate string manipulation # commands to change it to : # "Peter is diagnosed with anemia. Peter will # get blood packs in order to improve his anemia." # # Tip: Use the str_replace command # #################################################### ###### Question No. 9 ################################################## #################################################### # # Consider you have the following text: # "Peter is diagnosed with anemia. Peter will # get blood packs in order to improve his anemia." # # Use the appropriate string manipulation # commands to make the Peter name bold and # anemia italic. # # Tip: Use the str_replace command # #################################################### ###### Question No. 10 ################################################## #################################################### # # Consider you have the following array: # "WhiteBloodCell:4.4", "RedBloodCell:5.6", "Hgb:16.5" # # Use the appropriate string manipulation # commands to change the array to: # "4.4", "5.6" and "16.5" # # Tip: Use the strstr command and then substr & strlen # #################################################### ###### Question No. 11 ################################################## #################################################### # # Consider you have the following array: # ('Peter', 'Robin', 'Brian', 'Mark') # # Use the appropriate array manipulation # command(s) to sort it # # Tip: Use the sort command # #################################################### ###### Question No. 12 ################################################## #################################################### # # Consider you have the following array: # ('Peter', 'Robin', 'Brian', 'Mark') # # Use the appropriate array manipulation # command(s) to reverse sort it # # Tip: Use the rsort command # #################################################### ###### Question No. 13 ################################################## #################################################### # # Consider you have the following array: # ('Peter', 'Robin', 'Brian', 'Mark') # # Use the appropriate array manipulation # command(s) to reverse it # # Tip: Use the array_reverse command # #################################################### ###### Question No. 14 ################################################## #################################################### # # Consider you have the following array: # ('Peter', 'Robin', 'Brian', 'Mark') # # Use the appropriate array manipulation # command(s) to delete the last element of it # # Tip: Use the array_pop command # #################################################### ###### Question No. 15 ################################################## #################################################### # # Consider you have the following array: # ('Peter', 'Robin', 'Brian', 'Mark') # # Use the appropriate array manipulation # command(s) to delete the first element of it # # Tip: Use the array_shift command # #################################################### ###### Question No. 16 ################################################## #################################################### # # Consider you have the following array: # ('Robin', 'Brian') # # Use the appropriate array manipulation # command(s) to add 'Peter' at the beginning # and 'Mark' at the end of the array # # Tip: Use the array_unshift and array_push commands # #################################################### ###### Question No. 17 ################################################## #################################################### # # Consider you have the following array: # ('Peter', 'Robin', 'Brian', 'Mark', 'Bob') # # Use the appropriate array manipulation # command(s) to make another array which only # contains element number 2,3 and 4 # # Tip: Use the array_slice command # #################################################### ###### Question No. 18 ################################################## #################################################### # # Consider you have the following array: # ('Peter', 'Robin', 'Brian', 'Mark', 'Bob') # # Use the appropriate array manipulation # command(s) to replace element 'Brian' and # 'Mark' with 'John' # # Tip: Use the array_splice command # #################################################### ###### Question No. 19 ################################################## #################################################### # # Consider you have the following arrays: # ('Peter', 'Robin') # ('Brian', 'Mark', 'Bob') # # Use the appropriate array manipulation # command(s) to make an array including both of them # # Tip: Use the array_merge command # ####################################################