![]() |
# 1 |
עסק רשום [?]
|
בעיה עם SPLIT ב PHP 5.3
היי,
יש לי את הקוד הבא function findExtension ($filename) { $filename = strtolower($filename) ; $exts = split("[/\\.]", $filename) ; $n = count($exts)-1; $exts = $exts[$n]; return $exts; } עכשיו ב PHP 5.3 הוא מריץ שגיאה כי אין יותר SPLIT חרשתי את גוגל אבל לא מצאתי פתרון להחלפה למישהו יש מושג למה צריך להחליף את זה ??? תודה.
__________________
אחסון אתרים |
![]() |
![]() |
# 2 |
Whatever
|
בדוק לגבי preg_split
__________________
תומר |
![]() |
![]() |
# 3 |
עסק רשום [?]
|
התשובה הכי טובה שתוכל לקבל:
split is deprecated since it is part of the family of functions which make use of POSIX regular expressions; that entire family is deprecated in favour of the PCRE (preg_*) functions. If you do not need the regular expression functionality, then explode is a very good choice (and would have been recommended over split even if that were not deprecated), if on the other hand you do need to use regular expressions then the PCRE alternate is simply preg_split. מתוך: http://stackoverflow.com/questions/2...it-alternative |
![]() |
![]() |
# 4 |
עסק רשום [?]
|
ראיתי את זה , הבעיה שאני לא יודע להשתמש ב explode או preg_split וצריך לשנות תשורה שתתאים איכשהוא לפונקציות האלה.
כיוון שהם לא מקבלים את אותם הפרמטרים כמו split .
__________________
אחסון אתרים |
![]() |
![]() |
# 6 |
חבר על
|
תשתמש בEXPLODE זה גם הרבה יותר פשוט...
|
![]() |
![]() |
# 7 |
עסק רשום [?]
|
נניח ויש לך את התוכן הזה:
PHP קוד:
__________________
![]() איציק ברבי - שירות לקוחות כתובת אתר: http://build-net.co.il/ איימל: Support@build-net.co.il טלפון: 052-3937296. |
![]() |
![]() |
# 8 |
עסק רשום [?]
|
אני בטוח שאפשרי ואני ישמח לשמוע איך לייעל את הקוד הזה:
קוד:
<?php function checkfile($file){ $ext=explode(".", $file); for ($i=0; ;$i++){ if (!isset($ext[$i])){ $i=$i-1; return $ext[$i]; break; } if ($ext[$i]==""){ return "error"; break; }}} echo checkfile("asdasd.jpg"); ?> |
![]() |
![]() |
חברים פעילים הצופים באשכול זה: 1 (0 חברים ו- 1 אורחים) | |
|
|