fork download
  1. <?php
  2.  
  3. $text = "TITLE=Weird Al Yankovic - The Saga Begins (clip)
  4. # just to be informative (maybe future
  5. # use?)
  6. FILE=14233792,7972c637f619e01854ecb453b7339e3f # size,md5
  7. AUTHOR=Gabucino
  8. TYPE=VIDEO # maybe AUDIO in future (for displaying
  9. # mp3 lyrics while playing or whatever)
  10. FORMAT=TIME # this file contains measures based on
  11. # TIME, not frames.
  12.  
  13. # if FORMAT is a number, then it's frame based, i.e.:
  14. # FORMAT=25
  15.  
  16. NOTE=MPlayerSub test file v0.1
  17.  
  18. # first number : wait this much after previous subtitle disappeared
  19. # second number : display the current subtitle for this many seconds
  20.  
  21. 15 3
  22. A long, long time ago...
  23.  
  24. 0 3
  25. in a galaxy far away...
  26.  
  27. 0 3
  28. Naboo was under an attack.
  29.  
  30. 1 2.5
  31. And I thought me and
  32. Qui-Gon Jinn could
  33.  
  34. 0 2.5
  35. talk the Federation into
  36.  
  37. 0 4
  38. ...maybe cutting them a
  39. little slack.
  40.  
  41. 2 3
  42. But their response, it
  43. didn't thrill us,
  44.  
  45. 0 3
  46. They locked the doors,
  47. and tried to kill us.
  48.  
  49. 0 2.5
  50. We escaped from that gas,
  51.  
  52. 0 3.5
  53. then met Jar-jar and
  54. Boss-Nass.
  55.  
  56. 1 6
  57. We took a bongo from the
  58. scene and we went to
  59. Theed to see the Queen.
  60.  
  61. 0 5
  62. We all wound' up on
  63. Tatooine.
  64.  
  65. 0 6
  66. That's where, we've found
  67. this boy.
  68.  
  69. 0 4
  70. Oh my, my this here
  71. Anakin guy,
  72.  
  73. 0 5
  74. maybe Vader someday
  75. later now he's just
  76. a small fry.
  77.  
  78. 0 4
  79. And he left his home and
  80. kissed his mommy goodbye,
  81.  
  82. 0 5
  83. singing \"Soon I'm gonna be
  84. a Jedi!\"
  85.  
  86. 6 6
  87. Did you know this junkyard
  88. slave isn't even old enough
  89. to shave,
  90.  
  91. 0 3
  92. but he can use the Force,
  93. they say.
  94.  
  95. 1 6
  96. Ahh, do you see him hitting
  97. on the queen though he's
  98. just nine and she's fourteen
  99.  
  100. 0 6
  101. yeah, he's probably gonna
  102. marry her, someday!";
  103.  
  104. preg_match_all("/^([\d]+(?:\.[\d]{1,2})?) ([\d]+(?:\.[\d]{1,2})?)(?:[\n])((?:[\S ]+[\n]){1,})(?:[\n])?/m", $text, $matches);
  105. var_dump($matches);
  106.  
  107. // your code goes here
Success #stdin #stdout 0s 82624KB
stdin
Standard input is empty
stdout
array(4) {
  [0]=>
  array(21) {
    [0]=>
    string(31) "15 3
A long, long time ago...

"
    [1]=>
    string(29) "0 3
in a galaxy far away...

"
    [2]=>
    string(32) "0 3
Naboo was under an attack.

"
    [3]=>
    string(47) "1 2.5
And I thought me and
Qui-Gon Jinn could

"
    [4]=>
    string(32) "0 2.5
talk the Federation into

"
    [5]=>
    string(43) "0 4
...maybe cutting them a
little slack.

"
    [6]=>
    string(46) "2 3
But their response, it
didn't thrill us,

"
    [7]=>
    string(50) "0 3
They locked the doors,
and tried to kill us.

"
    [8]=>
    string(33) "0 2.5
We escaped from that gas,

"
    [9]=>
    string(39) "0 3.5
then met Jar-jar and
Boss-Nass.

"
    [10]=>
    string(75) "1 6
We took a bongo from the
scene and we went to
Theed to see the Queen.

"
    [11]=>
    string(35) "0 5
We all wound' up on
Tatooine.

"
    [12]=>
    string(41) "0 6
That's where, we've found
this boy.

"
    [13]=>
    string(37) "0 4
Oh my, my this here
Anakin guy,

"
    [14]=>
    string(58) "0 5
maybe Vader someday
later now he's just
a small fry.

"
    [15]=>
    string(56) "0 4
And he left his home and
kissed his mommy goodbye,

"
    [16]=>
    string(41) "0 5
singing "Soon I'm gonna be
a Jedi!"

"
    [17]=>
    string(70) "6 6
Did you know this junkyard
slave isn't even old enough
to shave,

"
    [18]=>
    string(41) "0 3
but he can use the Force,
they say.

"
    [19]=>
    string(87) "1 6
Ahh, do you see him hitting
on the queen though he's
just nine and she's fourteen

"
    [20]=>
    string(30) "0 6
yeah, he's probably gonna
"
  }
  [1]=>
  array(21) {
    [0]=>
    string(2) "15"
    [1]=>
    string(1) "0"
    [2]=>
    string(1) "0"
    [3]=>
    string(1) "1"
    [4]=>
    string(1) "0"
    [5]=>
    string(1) "0"
    [6]=>
    string(1) "2"
    [7]=>
    string(1) "0"
    [8]=>
    string(1) "0"
    [9]=>
    string(1) "0"
    [10]=>
    string(1) "1"
    [11]=>
    string(1) "0"
    [12]=>
    string(1) "0"
    [13]=>
    string(1) "0"
    [14]=>
    string(1) "0"
    [15]=>
    string(1) "0"
    [16]=>
    string(1) "0"
    [17]=>
    string(1) "6"
    [18]=>
    string(1) "0"
    [19]=>
    string(1) "1"
    [20]=>
    string(1) "0"
  }
  [2]=>
  array(21) {
    [0]=>
    string(1) "3"
    [1]=>
    string(1) "3"
    [2]=>
    string(1) "3"
    [3]=>
    string(3) "2.5"
    [4]=>
    string(3) "2.5"
    [5]=>
    string(1) "4"
    [6]=>
    string(1) "3"
    [7]=>
    string(1) "3"
    [8]=>
    string(3) "2.5"
    [9]=>
    string(3) "3.5"
    [10]=>
    string(1) "6"
    [11]=>
    string(1) "5"
    [12]=>
    string(1) "6"
    [13]=>
    string(1) "4"
    [14]=>
    string(1) "5"
    [15]=>
    string(1) "4"
    [16]=>
    string(1) "5"
    [17]=>
    string(1) "6"
    [18]=>
    string(1) "3"
    [19]=>
    string(1) "6"
    [20]=>
    string(1) "6"
  }
  [3]=>
  array(21) {
    [0]=>
    string(25) "A long, long time ago...
"
    [1]=>
    string(24) "in a galaxy far away...
"
    [2]=>
    string(27) "Naboo was under an attack.
"
    [3]=>
    string(40) "And I thought me and
Qui-Gon Jinn could
"
    [4]=>
    string(25) "talk the Federation into
"
    [5]=>
    string(38) "...maybe cutting them a
little slack.
"
    [6]=>
    string(41) "But their response, it
didn't thrill us,
"
    [7]=>
    string(45) "They locked the doors,
and tried to kill us.
"
    [8]=>
    string(26) "We escaped from that gas,
"
    [9]=>
    string(32) "then met Jar-jar and
Boss-Nass.
"
    [10]=>
    string(70) "We took a bongo from the
scene and we went to
Theed to see the Queen.
"
    [11]=>
    string(30) "We all wound' up on
Tatooine.
"
    [12]=>
    string(36) "That's where, we've found
this boy.
"
    [13]=>
    string(32) "Oh my, my this here
Anakin guy,
"
    [14]=>
    string(53) "maybe Vader someday
later now he's just
a small fry.
"
    [15]=>
    string(51) "And he left his home and
kissed his mommy goodbye,
"
    [16]=>
    string(36) "singing "Soon I'm gonna be
a Jedi!"
"
    [17]=>
    string(65) "Did you know this junkyard
slave isn't even old enough
to shave,
"
    [18]=>
    string(36) "but he can use the Force,
they say.
"
    [19]=>
    string(82) "Ahh, do you see him hitting
on the queen though he's
just nine and she's fourteen
"
    [20]=>
    string(26) "yeah, he's probably gonna
"
  }
}