logs archiveIRC Archive / Freenode / #php / 2015 / June / 30 / 1
runinsquares
zap0, what do you need the regex to do?
BlueShark
zap0: there's debuggex.com too - it has visualization, which is cool
Chunk2
is there any reason why this would be giving me a parse error on PHP 5.5 but not PHP 5.6?
http://hastebin.com/exiwizikur.coffee
zap0
at teh moment im struggling to have it move past the first character :(
netameta
how comes its not possible to have 1 field with default current timestamp on create, and then another timestemp field with on update?
In mysql
Chunk2
this is an extract from a class declaration btw
runinsquares
zap0, what does the end result string look like that you're trying to parse?
BlueShark
Chunk2: that seems to be true: http://3v4l.org/vand0
Chunk2
what am I doing that's not allowed?
         

zap0
runinsquares, "aaabb cc ddd" (1234)\teeee and i want to extract the numbers and the eeeeee
runinsquares
i assume abcd are always alphabetical?
is it case sensitive?
zap0
upto that 1st number i just don't care what it is
BlueShark
zap0: something like $re = '/\((\d+)\)\\\\t(\w+)/'; perhaps?
marlinc
Would it be possible to get the position of a thing being replaced by using preg_replace_callback()?
BlueShark
markin: use strpos inside the callback function?
AmirHossein
hi friends, its problem check session before session_start? some check ISSET($_SESSION['*'])) before or without session_start?
marlinc
The specific string could exist in the subject more than once, how would I solve that?
Alphos
BlueShark please avoid recommending debuggex.com. i've used it for 3 seconds and already found a major bug.
marlinc
AyoobAli
AmirHossein: you have to start the session
AmirHossein
dear i have problem to session_start
Alphos
BlueShark preg_match('@\bt', 'My test data') returns int(1), which is expected since there is a "t" as the first char of a word (namely "test") ; debuggex won't have it though
AmirHossein
when i session start in a script, if hold ctrl+f5 or press this much time this create session file absolutely. i want fix it by only start session if user logedin, or when login
zap0
BlueShark, lol.. i was opening the wrong file! FYI you're think didn't quite work; my regex was working fine... was wrong file !!! <facepalm>
BlueShark
Alphos: ah, alright.But it's nice with lookarounds etc. to see the visualization.
Alphos
BlueShark : but it doesn't work
BlueShark
-.-
zap0
http://regexper.com/ <-- this is awesome regex visualizer
Alphos
BlueShark i'm telling you your car may explode on you, you're telling me the paint job is great
         

b4r
,
YamakasY
I wonder if you can merge two parallel arrays with each other so it becomes [0] + [0] and [1] + [1]
Alphos
how about we stop recommending regexp websites altogether ? !+recommend
php-bot
how about we stop recommending regexp websites altogether ?, No, we cannot recommend <whatever you asked about>. We're here to help you write PHP code, not spend hours arguing the relative merits of A versus B. We won't recommend packages, libraries, scripts, sites, languages, version control systems, or sports teams; our only recommendation is that you please take your recommendations questions elsewhere (e.g., https://softwarerecs.stackex...
BlueShark
Alphos: lol. I don't rely on it :)
AmirHossein
AyoobAli: when i start session in a script, if hold ctrl+f5 or press this much time in browser php create a lotof session files absolutely. i want fix it by only start session if user logedin, or when login
zap0
Alphos, how about we act like humans
YamakasY
zap0: indeed, you moron :P
AyoobAli
AmirHossein: start your session and check if user logged in, if not use session_destroy()
Alphos
zap0 indeed : so how about we follow guidelines in doing so ?
YamakasY
(Action) slaps zap0 like a human
AmirHossein
AyoobAli: i use this now, but its my problem: if client do not have session cookie php create new session cookie and also session file in server, right?
runinsquares
YamakasY, what do you expect to happen using your ideal merge with these two arrays? $foo = ['abc', 'def', 'ghi']; $bar = ['jkl', 'mno', 'pqr'];
AyoobAli
AmirHossein: its not suppose to create multi session files, when you start the session it will open the same file
YamakasY
runinsquares: yes
BlueShark
YamakasY: boolean return value instead of an array - you mad bruh? :p
runinsquares
YamakasY, yes what? lol
YamakasY
BlueShark: not even drunk!
AmirHossein
AyoobAli: then if client do not have session cookie and request to script with session start if hold ctrl+f5 in browser (while loading page) php create a lotof session file!!!
YamakasY
runinsquares: I nedd to combine them in some way
BlueShark
YamakasY: then don't go home
AmirHossein
AyoobAli: dear i check it, its work what i say.
YamakasY
runinsquares: no!
runinsquares: I get 4 arrays and need to get make 2 out of them
runinsquares
YamakasY, you need to figure out the logic of your combine...
combine keys where they match?
YamakasY
BlueShark: http://i.imgur.com/1v9GZkn.jpg
runinsquares: yes have that, but how ?
BlueShark
:p
runinsquares
AmirHossein
AyoobAli:
AyoobAli: friend?
YamakasY
runinsquares: checking out
AmirHossein
friends? some one can help me?
AyoobAli
AmirHossein: are you sure you are using session_destroy() ?
runinsquares
or would you want: green, red, blue | green, red, yellow, black --> to give simply: green, blue, yellow, black (an overview of unique values)
AmirHossein
AyoobAli: i use session_destroy on user logout, but my problem is not it.
AyoobAli: wait.
Erisat
hello
AyoobAli
AmirHossein: if you want to delete the session that you started (for non-members) use session_destroy() after checking its a visitor and not a member
YamakasY
(Action) -o AcidReign as Acid is dangerous for this channel
Erisat
how would I parse a datetime from a string formatted as such: "1/1/0001 12:00:00 AM" - I'm writing the data from some c# program into a database, and im trying to compare datetimes in a php script.
AmirHossein
AyoobAli: if call session_destroy() session cookie and session file in server but delete?
YamakasY
(Action) + AcidReign with Water to give is some decent rain
Erisat
think thats Month/Day/Year, and then the time
AyoobAli
AmirHossein: no, only in the server,, for cookie you need to use setcookie()
AmirHossein
AyoobAli: mean remove session file in server and do not delete cookie file?
YamakasY
runinsquares: nope, but it gives me an idea
AyoobAli
AmirHossein: http://pastebin.com/w4ibPHr9
runinsquares
YamakasY, read through the array functions, maybe you see what you want.
http://php.net/manual/en/function.array-unique.php
AmirHossein
AyoobAli: thanks friend, but
AyoobAli: php create session file on see session_start() right?
AyoobAli
AmirHossein, yes
AmirHossein
AyoobAli: but create and set cookie on script exit, right?
AyoobAli
AmirHossein, yes
AmirHossein
AyoobAli: but if client got multi connection to site? ex= 100 connection in 1 secound, and script may exit in 2 secounds?
AyoobAli: its mean php create 100 session file, but last session cookie set for client and client use last session, right?
AyoobAli
AmirHossein, if the session is still not destroyed the script will use the same session, it will create a new session if it was deleted from the server or from the client cookie
AmirHossein
yes, but if this is login page? after user login we must delete session file?
BlueShark
Erisat: use DateTime::createFromFormat
AmirHossein
AyoobAli: if this is login page... first session create... if user success logined session wont delete, this also same other!
AyoobAli
AmirHossein, no, you need to keep the session to check if the user already logged in
AmirHossein, if the login was success, you'll keep the session, if not, you can destroy it
AmirHossein
AyoobAli: yes, i know that, but also we have the problem, coz in 100 connection php first create session (if not exist) (also if client got 100 request in one time all request do not have session cookie) then login and keep session file! mean first 99 request create session and cookie but last request also create new session but overwrite session cookie for client! now also we have 100 session file and one client whit one cookie.
« prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 next »