如何改变长篇文章a:3:{s:4:“year”; s:4:“2018”; s:5:“month”; s:2:“07”; s:3:“day”; s :2:“05”;}到2018-07-05

Hi I am using cakephp3 and saving data in key-value pair but not able to convert this

a:3:{s:4:"year";s:4:"2018";s:5:"month";s:2:"07";s:3:"day";s:2:"05";}

and result i want in this form

date 2018-07-05

in php

Give a try with below

$date = unserialize('a:3:s:4:"year";s:4:"2018";s:5:"month";s:2:"07";s:3:"day";s:2:"05";}');

echo 'date '.$date['year'].'-'.$date['month'].'-'.$date['day']; //date 2018-07-05