سؤال

I wanted to do something like this:

list($hour, $minute) = split("/:/", $departure_time);

however it says split() is deprecated why is this? What am I doing wrong?

هل كانت مفيدة؟

المحلول

split belongs to the ereg class functions, which have been superseded by preg_match and preg_split.

You should be using explode() anyway, since you only have a static string, not an actual matching pattern with variable placeholders.

نصائح أخرى

Use explode() instead of split().

like this:

$array = explode(':', $string);

You can use explode instead

$arr=explode("/:/", $departure_time);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top