Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,898 members, 7,810,448 topics. Date: Saturday, 27 April 2024 at 09:14 AM

Quiz: Dual Core Vs Afrobaby :: Php Coders Only :: Get His Contacts - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Quiz: Dual Core Vs Afrobaby :: Php Coders Only :: Get His Contacts (748 Views)

Most Confusing And Simple Maths Quiz / Silverslide Portfolio Wordpress Theme ( Best For You Designers/coders ) (2) (3) (4)

(1) (Reply) (Go Down)

Quiz: Dual Core Vs Afrobaby :: Php Coders Only :: Get His Contacts by Nobody: 11:54pm On Jul 19, 2011
Ah well, here we are again - i prrresent to you (presenta a ustedes) - another babes quiz yet again.

Plot:
In the part 1 of this quiz (link lost), dual core after chasing her for 2 whole years finally wins her heart only
for him to break it again at the end of the movie quiz.

Now:
In the sequela (this movie), afrobaby has been relentlessly trying to contact senor dual core and an information
got to her ears that dual core's contact can be reached on www.trudigits.com/dualcore.info

Now this file dualcore.info has been chmodded to 666 - this means - no public access to even view the url.

However, through some mago-mago means, afrobaby (who is now very desperate) managed to sneak a file
into the server (while dual core was busy chasing another babe).
The name of the file was (since it has been removed now after dual core swept his servers) dual.php (http://www.trudigits.com/dual.php)

Now, the task of the file (dual.php) was to read the dualcore.info into an array and perform other operations on it.


Let us assume that the dualcore.info contains:

Name = Dual Core
Sex = Male
Age = 3 decades
Address = http://www.sisvps.com
Phone = (070)www.trudigits.com
E-mail = support@trudigits.com
BBPIN = dual-007
Loves = Babes, Girls, Chics, Babes (again), senorita, mujeres,muchachas,mamacitas,mademoselles
Hates = Cockroaches, Lizards, Mosquitos and Rats

What is the easiest way for afrobaby to get this information into an associative array directly from the file?
Re: Quiz: Dual Core Vs Afrobaby :: Php Coders Only :: Get His Contacts by binkabir(m): 3:15pm On Jul 20, 2011
@dtml ar u kidding me??
on transit presently. but will give you from my codes i have this solution in my apps folder.


okey seeeeeee it

<?PHP
$dualcoreArray = array();
$file= fopen("dualcore.info", "rb"wink;

while (!feof($file) ) {

$line_of_text = fgets($file);
$line= explode('=', $line_of_text);

$dualcoreArray[$line[0]]=$line[1];

}

fclose($file_handle);

?>
Re: Quiz: Dual Core Vs Afrobaby :: Php Coders Only :: Get His Contacts by Nobody: 8:59pm On Jul 20, 2011
Caramba. If i were that babe i do not have time for long codes, i will simply say:
<?php
$dual=parse_ini_file("dualcore.info"wink;
echo $dual['name']; //this should gimme name nah?
or i just do a foreach or something. . . .
?>
Well, i won this quiz once again. . . . .watchout for the next quiz then.
Re: Quiz: Dual Core Vs Afrobaby :: Php Coders Only :: Get His Contacts by binkabir(m): 11:11pm On Jul 20, 2011
*dhtml:

?php
$dual=parse_ini_file("dualcore.info"wink;
echo $dual['name']; //this should gimme name nah?
or i just do a foreach or something. . . .
?>

cool but my answer is also okey. i like that grin grin grin
Re: Quiz: Dual Core Vs Afrobaby :: Php Coders Only :: Get His Contacts by Nobody: 5:02am On Jul 21, 2011
But of course your answer is quite ok and works too. But the thing is that PHP core already has an inbuilt function for reading those type of files.
You could also have rewritten your codes like this:
$info= file_get_contents("duacore.info"wink;
$lines=explode('\n',$info);
foreach($lines as $line) {
$line= explode('=', $line_of_text);
$dualcoreArray[$line[0]]=$line[1];
}

But in the real sense of the word, i was testing if you were familiar with the parse_ini_file function and could recognize that the structure
i described is in an ini structure - i just wanted to confuse a bit by giving the extension ehm info.

But nice attempt though. . . . .now solve the other array quiz. . . . .

(1) (Reply)

Buy Traffic From Nigeria / Introducing Double-edge Technologies / From Webhost To Web Host As A Reseller

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 12
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.