Skip to content

Instantly share code, notes, and snippets.

@amir
Created November 7, 2012 12:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amir/4031362 to your computer and use it in GitHub Desktop.
Save amir/4031362 to your computer and use it in GitHub Desktop.
Stay Classy!
r2d2➜ /tmp cat foo.php && php foo.php
<?php
$value = 1;
$some_object = new stdClass;
var_dump((int)$some_object);
var_dump($value == $some_object);
</script>
==========
PHP Notice: Object of class stdClass could not be converted to int in /tmp/foo.php on line 4
int(1)
PHP Notice: Object of class stdClass could not be converted to int in /tmp/foo.php on line 5
bool(true)
==========
@cubny
Copy link

cubny commented Feb 14, 2013

what does "script" tag do?

@amir
Copy link
Author

amir commented Apr 22, 2013

@cubny Sorry, just saw your comment.

According to[0] one way of starting a block of PHP code is:

<script language="php">
        echo 'some editors (like FrontPage) don\'t
              like processing instructions';
</script>

The thing is, you can open a PHP block of code one way, and close it the other way. So

<?php
</script>

is valid (hence ========== is printed as is as the last line).

[0] http://www.php.net/manual/en/language.basic-syntax.phpmode.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment