$street = $address['street_address'] . (($address['street_address_2']) ? $address['street_address_2'] . $cr : '');
$street is $address['street_address'] AND (IF - $address['street_address_2'] is non-empty, then use it, else use $cr) This statement is a ternary operator.
Lets do a quick run-through: (Even though I'm not sure what $cr is, but we'll work with it for the example..)
$street = "";
$address = array("street_address" => "33392 South 9th Street ", "street_address_2" => "Apt. 32b");
$cr = "No second address availabe.";
Ok, so, as you can see, our variables have been defined. Now, this may not be the way they are defined in your script, but this is just an example.. Remember?
Anyways, lets continue.
Now, $street will automatically (and always) have $address['street_address'] (or "33392 South 9th Street").
So, this part of the statement "(($address['street_address_2']) ? $address['street_address_2'] . $cr : '')" is to see if $address['street_address_2'] is not empty.
In the code above, its not. So, it will concentate ( or add strings together ). Therefore, $street will look like this:
"33392 South 9th Street Apt. 32b"
Now, lets say $address['street_address_2'] was empty.
In this case, $address would just be "33392 South 9th Street No second address available." (including $cr, don't forget that!)
I hope this helps you. Here's some references!
///////////////////////////////////////////////////////////////////////
Check out http://us2.php.net/operators.comparison for more information
<?php
// Example usage for: Ternary Operator
$action = (empty($_POST['action'])) ? "default" : $_POST['action'];
// The above is identical to this if/else statement
if (empty($_POST['action']))
$action = "default";
else
$action = $_POST['action'];
// Both methods work exactly the same, it just depends on how much code you want to do.
// Char Count:
//
// Ternary: 67 Characters
// If/Else: 87 Characters
// Now, the ternary operator will not always be the shortest statement. However, it can greatly reduce page breaks (ex: \n or \r)
?>