Using the string functions

Functions that compare two strings

strcmp($str1, $str2)
strcasecmp($str1, $str2)
strnatcmp($str1, $str2)
strnatcasecmp($str1, $str2)

How to assign a decimal value (base 10)

<?php
  $number_1 = 42;
  $number_2 = +72;
  $number_3 = -13;
  $number_4 = -(-39);
  $number_5 = --39;
?>

How to find the maximum and minimum integer values (base 10)

<?php
  $ max_int = PHP_INT_MAX;
  $min_int = PHP_INT_MIN;
?>

How to assign an octal value (base 8)

<?php
  $octal_1 = 0251;  // Must begin with 0
  $octal_2 = -0262;
?>

How to assign an hexidecimal value (base 16)

<?php
  $hex_1 = 0X5F;    // Must begin with 0x or 0X
  $hex_2 = 0x4a3b;  // Upper and lower case letters allowed
?>

Back