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! Quote 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() Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.