This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_msls_blog_collection_get( $objects ) { | |
$objects = array(); | |
$blogs = array( 1 => 'Override English', 2 => 'Override Deutsch', ); | |
foreach ( $blogs as $id => $description ) { | |
$details = get_blog_details( $id ); | |
if ( is_object( $details ) ) { | |
$objects[$id] = new MslsBlog( $details, $description ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'bar.php'; | |
require_once 'foo.php'; | |
$foo = new Foo; | |
$bar = new Bar( $foo ); | |
$foo->set_foo( 123.4 ); | |
$foo->set_bar( 123.4 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$template_dir = dirname (__FILE_) . '/templates'; | |
extract ($_REQUEST); | |
include ($template_dir . '/header.html'); | |
print_r (get_defined_vars ()); | |
include ($template_dir . '/footer.html'); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function scope_include ($file) { | |
if (is_file ($file)) { | |
include ($file); | |
return (get_defined_vars ()); | |
} | |
return (FALSE); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function getmicrotime () { | |
list ($usec, $sec) = explode(" ", microtime()); | |
return ((float)$usec + (float)$sec); | |
} | |
define ("TESTARRAY_MIN", 1); | |
define ("TESTARRAY_MAX", 10000); | |
define ("WINNERARRAY_MAX", 10); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$link = mysql_connect("mysql_host", "mysql_user", "mysql_password") | |
or die("Keine Verbindung möglich: " . mysql_error()); | |
echo "Verbindung zum Datenbankserver erfolgreich"; | |
mysql_select_db("Meine_Datenbank") or die("Auswahl der Datenbank fehlgeschlagen"); | |
$query = "SELECT * FROM Meine_Tabelle"; | |
$result = mysql_query($query) or die("Anfrage fehlgeschlagen: " . mysql_error()); | |
echo "<table>\n"; | |
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('MySQL_DB_HOST', 'mysql_host'); | |
define('MySQL_DB_USER', 'mysql_user'); | |
define('MySQL_DB_PASSWORD', 'mysql_password'); | |
define('MySQL_DB_NAME', 'Meine_Datenbank'); | |
class MySQL { | |
var $conn; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include_once ("db.php"); | |
$db = new MySQL; | |
$db->sql ("SELECT * FROM Meine_Tabelle"); | |
$result = $db->result (); | |
if (!empty ($result)) { | |
echo "<table>\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> class example(object): | |
__slots__ = ["x", "y", "z"] | |
>>> example = example() | |
>>> example.x = 0 | |
>>> example.y = '0' | |
>>> example.z = 'Null' | |
>>> example.a = 0 | |
Traceback (most recent call last): | |
File "", line 1, in ? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class slotObject { | |
function set ($input) { | |
$slot = array_keys (get_class_vars (get_class ($this))); | |
if (is_array ($input)) { | |
foreach ($input as $key => $value) { | |
if (in_array ($key, $slot)) { | |
$this->$key = $value; |
OlderNewer