1--TEST-- 2Test date_interval_create_from_date_string() function : basic functionality 3--CREDITS-- 4Rodrigo Prado de Jesus <royopa [at] gmail [dot] com> 5--FILE-- 6<?php 7$string = '1 day'; //P1D 8$i = date_interval_create_from_date_string($string); 9var_dump($i->d); 10 11$string = '2 weeks'; //14 days 12$i = date_interval_create_from_date_string($string); 13var_dump($i->d); 14 15$string = '3 months'; 16$i = date_interval_create_from_date_string($string); 17var_dump($i->m); 18 19$string = '4 years'; 20$i = date_interval_create_from_date_string($string); 21var_dump($i->y); 22 23$string = '1 year + 1 day'; 24$i = date_interval_create_from_date_string($string); 25var_dump($i->y); 26var_dump($i->d); 27?> 28--EXPECTF-- 29int(1) 30int(14) 31int(3) 32int(4) 33int(1) 34int(1) 35