The ? : is called the ternary operator, and is a short-hand way of writing an if/else block.
Your first PHP code snippet replaces anything like "&page=[any_number1-9_here]" to null within your query string.
Your second PHP code snippet is looping through every value of an array, and if the value of the current part of the array is equal to "b", re-assign that key of the array to equal a REGEX query. If not, also re-assign the key, but to a different REGEX query.