jeudi 2 avril 2015

PHP: How to split a number to multiple strings

I want to split a long number which i got into multiple strings in PHP. I got this:



<?php
$this = 020420151230;
?>


I want to get this result:



//output:
$this['day'] = 02;
$this['month'] = 04;
$this['year'] = 2015;
$this['hour'] = 12;
$this['minute'] = 30;


Can you please help and advice which function should i use for this?


Aucun commentaire:

Enregistrer un commentaire