@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19



Comments:

<0> hi
<0> is there a way to find out the realpath to ourself, as $_SERVER['PHP_SELF'] does?
<1> Yes.
<2> LeonWP, use SCRIPT_FILENAME
<0> ah
<2> or SCRIPT_NAME depends on what you really want
<3> How can I fetch an image from another url and save it locally on my server?
<3> fopen()?
<2> NickJane, yes, for example
<4> $fp = fopen('yourfilename.???', 'w'); fwrite($fp, file_get_contents('url')); fclose($fp); This is my way to do it.
<2> DtTvB, uh ? that won't be really efficient, if you could then use file_put_contents()
<4> Really?
<4> OK, new knowledge.
<2> s/if//
<5> um, copy() ?
<2> yep, copy or two fopen would be the most efficient alternatives



<6> Is there a way to count how many files there are in a folder, and echo out that value please? :)
<1> teach: Yep, see open_dir and readdir
<5> count(glob('dir/*'))
<6> thank you
<4> I can't use fsockopen to any other site, how to fix this?
<7> I can't get any type of output flushing to work on localhost. What can I try?
<3> Thing about copy() is it cant make a dir, can it?
<1> alta: Set it in the ini?
<8> i want to make a login for my site
<8> http://paste.debian.net/6634
<3> Tuxist: Use google for that one, you'll find many tutorials
<8> thats problem that all for my mysql
<9> why isn't preg_replace('/[^A-Za-z ]/', '', $data); removing everything except letters? (it's leaving numbers in the string)
<10> never used postgresql
<11> is there an contains / is in function I can use so that if($a=="a" or $a=="b" or $a=="c") becomes simpler like if($a isin("a","b","c")?
<7> in_array
<10> mmm but $a isnt an array
<12> rofl
<7> if (in_array($a, array('a','b','c')))
<11> fantastic, I really should have asked this a few years ago
<13> Hi, I know there's a CVS channel for this sort of thing, but it's dead. Could anyone who uses CVS answer a quick question?
<14> with opendir is it possible to go through the directory in the order of when the file was modified rather than alphabetically?
<7> kidk: no sorry. also, please don't ask to ask in future
<14> if ($dh = opendir($gallery['paths']['motddir'])) { is what i'm using atm, and seems that seeing as readdir has no extra options that its gotta be somewhere tod o with opendir
<14> but i don' get the documentation to do with the context bit
<10> Aeiedil: http://au.php.net/function.filemtime
<14> i've seen and do use that maskd_
<14> but i have a directory with text files and i want to select the newest 5
<14> so wthout a nice little loop to itterate through a directory, is there any other way?
<15> how can is do align left
<10> not that i know of Aeiedil
<15> except div style="align: left;"
<15> ?
<14> bah will just have to rename the files by timestamp
<10> Cy][aPb: that's not a php question.... look in #html
<15> ah sorry
<5> Aeiedil: $files = glob('dir/*'); $times = array_map('filemtime', $files); array_multisort($times, $files);
<14> O_O
<14> will give it a look
<16> Very quick question. Strings in PHP; null terminated or not?
<14> arpad: that does do what i want almost
<14> but i'm trying to sort int he opposite direction
<14> so that key 0 would be the newest file
<14> can't sem to see what to add in to get this to happen though :S do you know?
<16> krsort it then?
<16> (PHP 3 >= 3.0.13, PHP 4, PHP 5)
<16> krsort -- Sort an array by key in reverse order
<5> array_multisort($times, SORT_DESC, $files);
<14> ah i think i must have had the SORT_DESC in the wrong place then :D
<2> NeoThermic, where in PHP ? externally or internally ?
<14> thats perfect :) thanks :)
<16> colder: is there a diffrence? both? and internally if I can only chose one :)
<2> NeoThermic, if you don't hack the php src and/or write extensions, you don't erally care about how it works internally
<16> I like to care about odd things ;)
<2> but php strings are not terminated by \0, no
<16> I see, thanks
<15> hm
<15> $level = 1;
<15> $levplus1 = $level+1;
<15> currect?
<15> correct?



<17> y
<15> k thanx
<15> ok another question
<16> "yes"
<15> $rank3 = 30;
<15> $rank2 = 17;
<15> $level = 2;
<17> rtfm php.net
<15> $needed = $rank($level+1)-$rank($level);
<15> $rank($level+1)-$rank($level);
<2> Cy][aPb, use arrays
<15> will this line without php look like $rank3-$rank2
<15> ?
<16> $rank isn't an array (yet), so using ()'s wont work. Also suggest the first 3 chapters of php.net's manual
<2> you should use arrays instead of variable variables
<15> okey:)
<15> thank you
<2> NeoThermic, even if it was an array () wouldn't work :)
<15> $rank[$level+1]
<16> point, heh
<15> then it would look like this, y?
<2> yep
<16> I'm not thinking very well today
<15> $rank[10] = 1000;
<15> this will set array, y?
<17> y
<17> why wouldn't you read the manual ? i don't understand, if you are on a hurry, why not search for an open source script and work on it? reading the code will show you the syntax
<18> Hey. The <?= ?> syntax. Does that require short tags to be on?
<16> yes
<16> and its horrible
<16> and I would suggest against it
<17> if you can use <?, you can use <?=, but if you can only use <?php, you won't use <?=
<18> yeah. Just curious.
<16> portable means using <?php
<18> mmmhmm
<16> as I don't think its possible to disable them :P
<18> turn php off. :P
<16> short_open_tag boolean [...]
<16> Note: This directive also affects the shorthand <?=, which is identical to <? echo. Use of this shortcut requires short_open_tag to be on.
<16> http://www.php.net/ini.core
<18> cool
<19> i have a short syntax question... does (int) $variable set $variable to type integer?
<17> search for short in php.ini
<16> ruckerz: yes, it forces it to be an int
<19> NeoThermic thanks
<18> wait- does (int) $x; make $x an integer, or does it just return an integer from the value of $x, so you would need to do $x = (int) $x ?
<18> because I'd ***ume the latter but I've been wrong about PHP before.
<16> >php -n -r "$x = 'foo'; $y = (int) $x; echo var_dump($y); echo var_dump($x);"
<16> int(0)
<16> string(3) "foo"
<16> although, note:
<16> >php -n -r "$x = '5foo'; $y = (int) $x; echo var_dump($y); echo var_dump($x);"
<16> int(5)
<16> string(4) "5foo"
<16> (you can also catch out a few bad security checks with such an input)
<19> NeoThermic: does php automatically append an array if something is ***igned to it and the array already exists?
<20> woof
<16> as in $foo = array('bar', 'woof', 'Stormchaser'); $foo = 'ruckerz'; ?
<17> use $foo[]='ruckerz';
<16> is_null: yeah, I'm just trying to get a handle on ruckerz's question :P
<17> np sir :)
<17> anyone has a favourite IDE for php developpement ?
<19> NeoThermic: yeah so that would give $foo['bar'], $foo['woof], and $foo['Stormchaser'], all with null values , what if i set $foo['ruckerz'] = 'blah'? will ruckerz get appended?
<16> ah, hmm
<17> yes
<16> yeah
<16> heh
<20> is_null: No, I use SATA.
<19> gratzi =)
<19> thanks all
<16> oh, bugger


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #php
or
Go to some related logs:

#perl
mysql subquery not dependant
#ubuntu
mason_handler.f
#asm
ubuntu bcm4311
skipe problems on ubuntu
451 error while spooling file
ubuntu movies samba
#mysql



Home  |  disclaimer  |  contact  |  submit quotes