pedromsouza Posted February 28, 2011 Share Posted February 28, 2011 When I use a method within a class, I get this error: [28-Feb-2011 14:48:37] PHP Warning: checkdate() expects parameter 1 to be long, string given in /Applications/MAMP/htdocs/classe_PreparaData.inc on line 17 Class Itself class PreparaData { public $saida; function validar_input ($entrada) { if(!(strlen($entrada)==10) and (strstr($entrada,'/'))) {echo "A data deve respeitar a formatação dd/mm/aaaa!<br>";} } function montar_timestamp ($entrada) { $a_partes=explode("/",$entrada); echo $a_partes[1].$a_partes[0].$a_partes[2].'<br>'; if(checkdate('$a_partes[1]','$a_partes[0]','$a_partes[2]')) {function exibir_data ($a_partes){ if(!(empty($a_partes))) {echo "$a_partes[1].$a_partes[0].$a_partes[2]";} ;};} else {echo "Data inválida!<br>"; var_dump($a_partes);} } function gravar_output ($saida) { $query=mysql_query("insert into tabela value ('$saida')"); } } ?> Help! Link to comment https://forums.phpfreaks.com/topic/229158-28-feb-2011-144837-php-warning-checkdate-expects-parameter-1-to-be-long/ Share on other sites More sharing options...
ignace Posted February 28, 2011 Share Posted February 28, 2011 checkdate($a_partes[1],$a_partes[0],$a_partes[2]) checkdate() Link to comment https://forums.phpfreaks.com/topic/229158-28-feb-2011-144837-php-warning-checkdate-expects-parameter-1-to-be-long/#findComment-1180902 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.