Home > Back-end >  Using php Get YY from string dd.mm.YY
Using php Get YY from string dd.mm.YY

Time:11-01

my input string: dd.mm.yy

With php, how can i extract yy?

example

input = 17.03.19 (dd.mm.yy)

output: 19 (yy)

thank you

CodePudding user response:

<?php

// Your input
$input = "17.03.19";

// Explode with that separator
// $temp[0] will contain : 17
// $temp[1] will contain : 03
// $temp[2] will contain : 19
$temp = explode(".",$input);

$output = $temp[2];

echo $output;
  •  Tags:  
  • php
  • Related