$n = 1;
echo ( $n == 1 ? "1st" : ( $n == 2 ? "2nd" : "" ) ) . "\n";
$n = 2;
echo array_search( $n, array( '1st' => 1, '2nd' => 2 ) ) . "\n";
here’s how to effectively convert it to an object (stdClass) and use the object property syntax instead…
$a = array( 'one' => array( 'number' => 1, 'ordinal' => '1st' ) );
echo $a[ 'one' ][ 'number' ] . "\n";
$o = json_decode( json_encode( $a ) );
echo $o->one->ordinal . "\n";
and here i thought php would supply a default value for the second parameter to fread(), namely the number of bytes to be read from an open file handle (that being the first parameter). nope! not only does this quietly surpass php’s syntax check, it causes an internal server error thus creating quite the air of mystery as to what went wrong.
sitepoint recently discovered when and why row-level locking (as opposed to table-level) is sometimes a must-have…
for those of you out there charged with developing/maintaining ecommerce sites using verisign/paypal’s “payflow pro” interface, be aware that as of september 1st (yes, three weeks away) older versions of their sdk will no longer be supported.
information about the upgrade (and instructions on how to perform the required code changes to your site(s)) can be found here:
p.s. this might be a good opportunity to switch to authorizenet since the newer payflow pro sdk uses Very Similar ‘silent’ https post’s to/from the gateway server (as opposed to an intermediary native-code binary in older versions) and might even save you/your client(s) some money, since the two gateways’ pricing structures vary when it comes to per-transaction fees and minimum/maximum sales volume thresholds. have that conversation with your merchant services provider.