execute code one time

hello there,
I have this code that its supposed to output just one hello but this is what im getting
"hello worldhello world"

preg_replace("/.*/e","eval(gzinflate(base64_decode('S03OyFdQykjNyclXKM8vyklRsgYA')));",".");

Open in new window


how can I fix it?
LVL 1
XK8ERAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Julian HansenConnect With a Mentor Commented:
Don't eval the string - just deflate it.

By eval'ing it you are asking php to execute what is in the string. As it includes an echo - it is going to output the echo.

Also the way you are using your preg_replace is confusing.

You say you want to output hello - but you don't have any echo statements in your code sample - you also have the input string as the second parameter - which is the replace ment parameter.
It should be

preg_replace(pattern, replacement, subject)

What are you wanting out of the preg_replace?
0
 
Julian HansenCommented:
The inflated string is echo "Hullo World" with an eval in front of it - is going to output Hullo World ....
0
 
XK8ERAuthor Commented:
yes but what can I do so it only display one "hello world"
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.