-2

I want to cut a word in PHP but I only want the number. here is my word

$myword = BPT-11

I only want is 11

How can i do this? using split or substr

VLAZ
  • 26,331
  • 9
  • 49
  • 67
MoteCL
  • 228
  • 3
  • 20

1 Answers1

2

You can use explode.

$myword = "BPT-11";
$exploded = explode("-", $myword);
echo $exploded[1];
//return 11

Reference:

http://php.net/manual/function.explode.php

Juliano
  • 36
  • 3