Category: Programming

  • strlen vs mb_strlen in PHP

    strlen vs mb_strlen in PHP

    As a PHP developer, I am sure you use strlen often to check for the length of strings. strlen does not return the length of a string but the number of bytes in a string. In PHP, one character is one byte therefore for characters that fall within the 0 – 255 range in ASCII/UTF-8…

  • Quick one on Python random numbers sampling

    I have been working on a project to generate random data using Python. Since I am not using this project for any security application I opted for the Python pseudo-random number generator random . In order to randomly select items from a list three option presented themselves to me random.choice, random.choices and random.sample . random.choice…