Let's say we want to write the number eighteen. How can we write it? Well... certainly 18 works. But we can also write it as 10010 (in binary) or 12 (in hexadecimal) or a variety of other ways depending on the base we use. Converting between bases in PHP can be done using the base_convert () function.