This code behaves different on my system as on for example codepad and i don't understand why.
http://codepad.org/jBmXRgyY
The output on my system is only 0.
Does anyone know where to look?
found a workaround by myself.
foreach($chstr->channel->children() as $test)
echo (string)$test."\n";
works fine for me.
Related
Hello everyone I am trying one very simple thing but unfortunately for a reason that I don't get I can't have the desired result.I am trying to colourize a string everytime that is beign generated. I am running the example to an online interpreter and this is what I get back.
<?php
echo "<p style='color:red;'>Hello Wolrld</p>";
?>
Result :
<p style='color:red;'>Hello Wolrld</p>
The whole thing is treated as a string from the echo which seems ok but I don't know how to structure or write it in order to get back the word Hello World in red.
Thank you very much
Code works ok. Interpreter does not show PHP output properly, but shows HTML code encoded.
If you will try that code in your local server (XAMPP, or similar) it will work OK. It is a problem on interpreter side.
So I am having problems with the symbol µg in PHP. The symbol is inside an array of data but I can't seem to match it with the following:
if($value == 'µg') {
echo 'blah';
}
Does anyone happen to have a work around for this? I'm assuming PHP saves it as a different type then what I am comparing it to because it never echo's the 'blah' above. I have searched around for a while now and cannot find anything to help me. Thanks!
Okay so even with the help of some people I haven't found the answer.
The best I came up with that actually works is:
substr('µg', 1,7) == 'micro;g'
That's the only way I found out how to parse the data. If you put the & in front of the micro; you get the µ. A dirty fix but if anyone has a way around please let me know. Thanks!
I'm studying Simple_HTML_DOM and I found a problem where I'm working on from 2 hours without finding a solution :-(
I've the following code:
$num = $html->find('span.pageNum');
This code get number of pages on my blog and it works. GREAT.
If I do
echo $num[0];
I see the number of pages on screen, but if I try to do something like:
echo ($num[0]+2);
for example, It doesen't work like an INTEGER and it return me the following output:
3
So, I need to make the "find" to an integer and work for math operations but I tried everything and nothing works (like cast with (int)$num[0] and much more).
Can anyone please help me? I don't know what to do more...I really tried everything!! :-(
Thanks in advance!!
FOUND THE SOLUTION!!
I used:
$pgnum = filter_var($num[0], FILTER_SANITIZE_NUMBER_INT);
worked GREAT!! Thanks :-)
I have a file that I'm trying to decode but I'm not sure the best way to go about doing it. I've tried putting it through a few online tools but haven't had much luck...the code looks like this:
<?php
$zAkSoSavjFOn='jumbledcodeinhere';
$THkNltHSOjsXfQLzr=';))))aBSwinFbFxNm$(ireegf(rqbprq_46rfno(rgnysavmt(ynir';
$DzbOntpeGhMcan=strrev($THkNltHSOjsXfQLzr);
$WnJYuMUwKmRxBh=str_rot13($DzbOntpeGhMcan);
eval($WnJYuMUwKmRxBh);
?>
In all my playing I managed to extract the following with a php script:
eval(gzinflate(base64_decode(strrev($zAkSoSavjFOn))));
Could someone point me in the right direction on going about this process? Any help would be appreciated. :)
The "jumbled code" is gzipped, base64-encoded, reversed PHP code that is almost certainly malicious.
Replace eval with echo and see what it gives you, that's what the code that is trying to run is.
I found a very strange bug using this word ""a".
I am using the cPanel API.
I tested Firefox, Chrome, Safari, and others.
Do it yourself.
Simple PHP:
<?php
echo ""a";
?>
Return:
"a
JSON API shape cPanel
https://hostname.example.com:2087/cpsess##########/json-api/cpanel?cpanel_jsonapi_user=user&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=Email&cpanel_jsonapi_func=addpop&domain="example.com"&email="user"&password="12345luggage""a="500"
Return:
https://hostname.example.com:2087/cpsess##########/json-api/cpanel?cpanel_jsonapi_user=user&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=Email&cpanel_jsonapi_func=addpop&domain="example.com"&email="user"&password="12345luggage""a="500"
Could someone help me put this ""a"?
I tried to think of everything.
I already put:
Is it possible to cheat using PHP?
"a -> back "a
"A
Believe appears and &quoTA, but does not send the string (should be lowercase).
Searching on http://www.w3.org/TR/html4/appendix/notes.html#h-B.2.2. and in the PHP manual using urldecode and urlencode for help "#IdontDownVote" I understood better about my problem.
What did I do
<?php
$e_com=htmlentities(urldecode('"a=1000'));
echo $e_com;
?>
I had to decode
http://php.net/manual/pt_BR/function.urldecode.php
Thank you very much