PHP

Support group for those afflicted with PHP. Don't ask to ask, ...
Nov 17, 2016 11:02
yes, that works in PHP, thanks; but how to achieve the same in awk :)
Nov 17, 2016 10:59
can you please show full example
Nov 17, 2016 10:57
@PeeHaa i think without the last pipe this doesn't match prefix but only prefixsomething
Nov 17, 2016 10:55
hi! i know this isn't the best place to ask but still ... i have some bash script executed from php and it uses awk; in PHP i usually use prefix(?:something|) to match both prefix and prefixsomething meanwhile this doesn't work with awk. does anyone know how to do this in awk regex?
Oct 4, 2016 18:12
hi! my PHP app must have implemented SOAP server and i'm just banging with my head to wall with stock SoapServer class. i already wanted to switch to Zend SOAP implementation, but seems I will encounter the same problem as in case of stock implementation. basically the problem is that i want to pass only one function to SoapServer and this function is in the same class as i'm creating SoapServer object... is there any way to include function in same class?
Jul 1, 2016 10:08
Hello! I would need some help with regex - I'm working on script that would show potentially dangerous requests, but somehow I can't filter URL correctly. This is the base regex which matches URL containing other URLs in GET parameter(s): ^”(GET|POST).*\?.*\=http\:\/\/.* HTTP\/.*$. I want to ignore URLs that matches word 'goto' in parameters... this is what I have so far, but it's working only if this word appear somewhere in URL: ^"(GET|POST).*\?.*(?!.*goto)\=http\:\/\/.* HTTP\/.*$ Thanks!
Jun 3, 2016 12:37
@Dereleased thank you very much for the solution!! :)
Jun 3, 2016 12:36
@Dereleased thanks, this one works as expected; do you have any suggestion on how to limit special characters (č, ć, ž, š, đ), so those point/delete characters can't be used?
Jun 3, 2016 12:32
if anyone maybe know what is wrong... i need a little help with regex - i just need to add slash to this regex: /^[a-ž_-]+$/i but somehow i can't figure what's wrong with it... i tried numerous combinations but i didn't find right one... please help
Jun 3, 2016 12:31
@Wes what can go wrong if I allow this range of characters? This regex is used for checking metric units in form for some closed information system, but the problem is that I don't know how to allow all those characters (ok, without point characters) as easy as with a-ž... overall I don't think anyone will ever use those point characters, since this system will be used only by few people.
Jun 3, 2016 10:41
@Wes there is no problem with this, because copyright mark can also be used...
Jun 3, 2016 10:27
@Wes yes, because of special characters - č,ć,š,đ,ž,...
Jun 3, 2016 10:25
@DejanMarjanovic yes, but also doesn't work -> I'm also testing here: functions-online.com/preg_match.html
Jun 3, 2016 10:20
@DejanMarjanovic yes -> /^[a-ž_-/]+$/i , /^[a-ž_-\/]+$/i
Jun 3, 2016 10:19
hello! i need a little help with regex - i just need to add slash to this regex: /^[a-ž_-]+$/i but somehow i can't figure what's wrong with it... i tried numerous combinations but i didn't find right one... please help
Oct 8, 2015 19:19
@kelunik thanks for solution... in my case regex is the best solution, because i unfortunately don't work with valid html and there is a lot of other elements along, so i just need to somehow comment/delete those img tags out ;)
Oct 8, 2015 19:09
@PaulCrovella: thanks for this, but i would like to use this regex with preg_replace, because i need to comment out those images...
Oct 8, 2015 19:06
hello! i need some help with regex for extracting html img tag. the problem is that i don't know how to correctly stop function to read only each tag start and end with content, without other content which could be between more tags. here's what i have so far: regex101.com/r/sQ5iI9/1 <-- each img (<img ...></img>)tag should be matched as one, so the text between those two tags (in example) shouldn't be matched. thanks for help in advance!
Sep 15, 2015 07:39
@Rafee i forgot to mention i think variables representing class properties :/
Sep 15, 2015 07:28
hello! which way of getting and setting variable do you prefer and why? i'm a little bit confused, because there's too much comments on all that and nobody from php developers confirmed what would be the best way. thanks for help in advance! :)
Sep 8, 2015 07:44
hello! i have a question about php exceptions... i primarly work with java where are two main exceptions possible - one that you just need to throw exception and the program still run, and the other that the exception is thrown and program halt. in both cases there's no catch part. is in php anything similar to the mentioned concept?
Aug 16, 2015 18:15
I updated the question here: stackoverflow.com/questions/32033617/… I don't know why is the output for second file wrong when I use seek... What could be wrong?
Aug 16, 2015 17:26
i found out what's the problem that the output of my file is wrong.. more about problem here - check UPDATE: http://stackoverflow.com/questions/32033617/php-changing-object-in-loop-while-iterating-over-it .. it seems that seek() is problematic and is somehow blocking correct reading of second line in my file. what can i do to solve this problem?
Aug 16, 2015 16:58
i found out what's the problem that the output of my file is wrong.. more about problem here - check UPDATE: stackoverflow.com/questions/32033617/… .. it seems that seek() is problematic and is somehow blocking correct reading of second line in my file. what can i do to solve this problem?
Aug 16, 2015 13:36
@Danack exactly the same problem with your code as with my recursive function :| I will try to run both codes with some easy examples and then I'll see where is the real problem
Aug 16, 2015 13:29
@Danack i have something similar in my recursive function, but I will also try your code... thanks!
Aug 16, 2015 13:22
@RonniSkansing yes, i'm sure there must be something with pointers or stuff like that, because I tried different ways of reading file and the problem still exists
Aug 16, 2015 13:13
hi all! i have a problem with SplFileObject - it's showing me duplicated first line of file... more about the problem here: stackoverflow.com/questions/32033617/… ... what could be wrong? :/
Aug 12, 2015 09:41
@albru123 this is the last place i come to ask for help if i can't find the answer... it looks like today is a special day for this room :)
Aug 12, 2015 09:38
can you please stop complaining about the rules and stuff, and please help me with my question... isn't this room created for helping each other not for spamming?
Aug 12, 2015 09:32
i have a problem with substitution character - diamond question mark - � in text i'm reading with splfileobject. this character is already present in text file, so nothing can't be done to convert it to some other encoding. i decided to search for it with preg_match, but the problem is that php don't find any occurence of it - php probably sees it as different character as �. i don't want to just remove this char from text. is there any way to match this character in php?
Aug 12, 2015 09:19
hello! i have a problem with substitution character - diamond question mark - � in text i'm reading with splfileobject. this character is already present in text file, so nothing can't be done to convert it to some other encoding. i decided to search for it with preg_match, but the problem is that php don't find any occurence of it - php probably sees it as different character as �. i don't want to just remove this char from text. is there any way to match this character in php?
Aug 9, 2015 11:13
@kelunik exactly like that, thank you :)
Aug 9, 2015 10:51
hello! i need a little help on php regex... i would like to match all numbers which don't have dot or comma before of it (alongside space)... here is uncomplete example: regex101.com/r/xS3eM3/1 <- this number shouldn't be matched because there's comma before
Aug 6, 2015 12:31
@HamZa i have another problem with the same regex... what would you do if there shouldn't be a match in case of another ":" is before "Total: Pages 11"? Example: regex101.com/r/vU4oU8/2 <-- basically there shouldn't be any match, but only if there would be "Total: Pages 11"
Aug 6, 2015 11:22
thank you very much :)
Aug 6, 2015 11:21
yes, i know that, but it's possible to get rid of this empty string somehow?
Aug 6, 2015 11:20
with preg_match i get three values:
array (
0 => ': Pages 11',
1 => '',
2 => '11',
)
Aug 6, 2015 11:19
@HamZa zero-length match... it's empty string
Aug 6, 2015 11:15
hello! i need a help with PHP regex... i have preg_match with "/:[\s]*(?:([\d]+)\.[\s]*page|Pages[\s]*([\d]+))/i" but the problem is if I have string like "Total: Pages 11", there are zero match and 11 as result. how can i get rid of zero match?
Aug 4, 2015 16:58
@Sherif thank you very much for help. I got pissed off because he has almost every reply to my question in the same style ;)
Aug 4, 2015 16:49
probably after you reply to every single question for which you don't know solution :D
Aug 4, 2015 16:47
@tereško sorry god because i'm learning, i just came here for help not for the feedback and comments of what i'm doing. if you want to help me than I will be thankful for this, otherwise you can easily shut up and switch tab in the browser. a lot of different communities are fucked up because of dumbs like you -> everyone want to have million users of their service, but when someone ask for help, they say do it yourself and when you will be pro, you can help other people.
Aug 4, 2015 16:37
@tereško number of dots should be unchanged when the message arrive to my script, but those dots are instead of spaces. it's a special way of communication which hides actual separation of words... here are some rules about that, i'm just programming this, don't have much other info
Aug 4, 2015 16:21
because I get string from user which should be separated with space in the form of two dots... so two dots (or more than 3) should be changed to space.
Aug 4, 2015 16:20
@ircmaxell why why? :D
Aug 4, 2015 16:18
hello! i'm working on some script and i need to use preg_replace. the problem is that i need to replace two dots (..) or more, but not one or three. For example -> "This is...something..here" should become "This is...something here". I was working on regex string to get this working, but didn't finish yet. Here is what I have: /([^\.]*)\.{2}([^\.]*)/i
 

C#

General discussions about the c# language, Squirrels | gist.gi...
Feb 22, 2014 18:18
hello! can you please help me with background worker and create directory. i want to create directory inside worker's dowork, but there's no anything after worker finish. what could be wrong?
Feb 22, 2014 14:29
bye!
Feb 22, 2014 14:29
just "file.txt"