echo "--- start incdecrev ---\n"; $y = $x; var_dump($x); ++$x; var_dump($x); ++$x; var_dump($x); --$x; var_dump($x); --$x; var_dump($x); // equivalent code using -=/+= instead of --/++. var_dump($y); $y += 1; var_dump($y); $y += 1; var_dump($y); $y -= 1; var_dump($y); $y -= 1; var_dump($y); echo "--- end incdecrev ---\n"; } $i32 = 1 << 31; // if this is negative, we have a 32-bit int $i64 = 1 << 63; // same as $i32 for 32-bit int; otherwise, is 64-bit $IntMin = $i32 < 0 ? $i32 : $i64; $IntMax = ~$IntMin; incdec($IntMin); incdecrev($IntMax);
incdec("543J"); incdecrev("543J9"); incdec("543J9"); //*/ ///* // strings ending in non-alphanumeric characters incdec("&"); incdecrev("&"); incdec("83&"); incdecrev("83&"); incdec("83&8"); incdecrev("83&8"); incdec("83&Z8"); incdecrev("83&Z8"); incdec("83&z8"); incdecrev("83&z8"); incdec("&28"); incdecrev("&28"); incdec("&98"); incdecrev("&98"); //*/ ///* $x = "aa"; var_dump($x); var_dump(--$x); var_dump(--$x); $x = "zza"; var_dump($x); var_dump(--$x); var_dump(--$x); //*/