My life be like

PHP is weird sometimes

“Every once in a while you you come across something that is so strang…” Published at: 2019-02-20

In PHP when storing an string that could be a valid integer PHP casts it to an int for you. Why?


    $array: [
      "123" => 'php'


    // Output

    array(1) {

    // instead of

    array(1) {

In javascript the same is possible. I don’t know if this is intended behaviour but for me it feels weird and counterintuitive.

Oscar te Giffel

Oscar te Giffel. I wan't to learn so many things. This is just my journey through life.