Jump to content

Recommended Posts

<?php $day = $_POST['day'];        ------------->09

  $month = $_POST['month']; ---------->02

  $year = $_POST['year'];--------------->2009

  $num= "/".$day."/".$month."/".$year; ---->09/02/2009

  //echo $num;

              explode("/",$num);

  echo $num[0];

    echo $num[1];

    echo $num[2];

 

?>

 

can anyone help me how to get result like this    "9022009"

Link to comment
https://forums.phpfreaks.com/topic/172668-solved-explode-simple-question/
Share on other sites

$num= "/".$day."/".$month."/".$year; ---->09/02/2009

 

Is

 

$num= "/".$day."/".$month."/".$year; ---->/09/02/2009

 

Then:

 

explode("/",$num);

 

Should be:

 

$num = explode("/",$num);//returns Array ( [0] => , [1] => 09, [2] => 02, [3] => 2009);

 

Remove the leading forward slash:

 

$num= $day."/".$month."/".$year; ---->09/02/2009

 

And you'll get:

 

$num = explode("/",$num);//returns Array ( [0] => 09, [1] => 02, [2] => 2009);

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.