Skip to main content

All Questions

Tagged with
1 vote
2 answers
102 views

Check URL for keywords [closed]

I'm looking at improving my PHP knowledge and wondering if anybody has any tips on improving and optimising my function below? ...
stu's user avatar
  • 21
2 votes
1 answer
135 views

Extract string between first occurring set of parenthesis

I have this function and need to refactor it Please refactor the code below to make it more concise, efficient and readable with good logic flow ...
mghifariyusuf's user avatar
1 vote
5 answers
3k views

PHP function to obtain model_name from Namespace\To\ModelName

Would there be a more clear/efficient way to write ...
Grey's user avatar
  • 217
2 votes
2 answers
128 views

Writing a ~100Kb HTML string over an MD file (number of iterations ~10K)

I have tried to write a large string (~100-120 Kb of HTML) on an md file, and am pretty sure it's not the fastest method, even though it only has to iterate ~8000-...
Emma's user avatar
  • 3,592
0 votes
2 answers
155 views

Sanitizing name strings using PHP

Functionality: This method removes a list of specific terms (e.g., LLC, INC, Inc, Company, etc.) from a list of public companies names. It is part of a class that can be viewed in this link. I'd ...
Emma's user avatar
  • 3,592
3 votes
3 answers
231 views

Retrieve words from dictionary when they meet letter requirements

I have a set of functions that retrieve words from some arbitrary dictionary based on what letters they have. For example, this function gets words that use only the specified letters: ...
Andreas Hunter's user avatar
1 vote
0 answers
2k views

Which function is faster levenshtein() or similar_text()?

Brief I wrote two functions using levenshtein() and similar_text(). The functions will find similar words from the dictionary ...
Andreas Hunter's user avatar
-1 votes
1 answer
61 views

Reverse a string and change the position [closed]

Reverse the string to get out as This is durga @ no. 1 position. Is below solution memory optimistic. How can we achieve the same without using a string function like i used strlen. ...
Bugfixer's user avatar
  • 101
2 votes
2 answers
367 views

Split words that are too big

I need to optimize the below code, as much as possible in: using less resources as possible being as fast as possible What the code does is simple, it splits the string by words and only if a word is ...
Prix's user avatar
  • 165
3 votes
1 answer
2k views

Replacing Perisan and Arabic digits

I'm using this function to replace UTF-8 characters representing numbers in text with 'normal' digits. I'm wondering if this is optimized code since this is using two ...
Developerium's user avatar
4 votes
3 answers
10k views

Performance: getting first value from comma delimited string

I've got a string that has values that are delimited by comma's, like so: $var = '1,23,45,123,145,200'; I'd like to get just the first value, so what I do is ...
kasimir's user avatar
  • 243
3 votes
1 answer
5k views

Find ASCII codes and replace with characters

I have a text file that uses the convention #\d+ to mean ASCII character number \d+. I want to replace any such representations ...
dnagirl's user avatar
  • 163