<?php$db = new PDO( 'mysql:unix_socket=/cloudsql/hello-php-gae:my-cloudsql-instance;dbname=demo_db;charset=utf8', 'demo_user', 'demo_password');foreach($db->query('SELECT * FROM users') as $row) { echo $row['username'].' '.$row['first_name']; //etc...}
<?php$handle = fopen('gs://hello-php-gae-files/prime_numbers.txt','w');fwrite($handle, "2");for($i = 3; $i <= 2000; $i = $i + 2) { $j = 2; while($i % $j != 0) { if($j > sqrt($i)) { fwrite($handle, ", ".$i); break; } $j++; }}fclose($handle);
<?php$primes = explode(",", file_get_contents('gs://hello-php-gae-files/prime_numbers.txt'));if(isset($primes[100])) echo "The 100th prime number is ".$primes[100];
Use promo code NEXT1720 to save $300 off general admission
No comments :
Post a Comment