Jump to content

GingerRobot

Staff Alumni
  • Posts

    4,082
  • Joined

  • Last visited

Everything posted by GingerRobot

  1. Kinda depends on the array. Assuming an array with keys 0,1,2,3,4,5 etc: for($i=0;$i<5;$i++){ echo $array[$i].'<br />'; } If you have other keys, you could try: $i=0; foreach($array as $v){ echo $v.'<br />'; if(++$i==5){ break; } }
  2. There's a pretty long poll here about it. Personally i use php designer 2007.
  3. "Invasionfree"? I would make some joke, but im sure someone would object to it. Back on subject, there's a couple topics asking the same question here and here
  4. Not really. An abacus was develeped to help people count. Previously, people may have used some form of counters. Also, couldn't you argue that there never was 'a first idea', since 'the second idea' could be based on some element of chance? Taking neylitalo's example of the wheel - by chance people saw a log rolling down a hill, and this was the basis for using logs to help transport things.
  5. Yeah, arrays are the way to go for sorting. You could easily transform you variables to an array like: <?php error_reporting(E_ALL); $D01 = 444; $D02 = 474; $D03 = 644; $D04 = 447; $D05 = 488; $D06 = 554; $D07 = 1; $D08 = 44; $D09 = 1444; $D10 = 24; $D = array(); for($i=1;$i<=10;$i++){ $D[$i] = ${'D'.str_pad($i,2,0,STR_PAD_LEFT)}; } rsort($D); echo '<pre>'.print_r($D,1).'</pre>'; ?> Though it would be better to put them in an array to start with.
  6. So to clarify, the email sends? And is it just missing some information? Which bits exactly? Also, could you show us the form?
  7. Try: <?php $str="<b>Blah1:</b> 11<br/> <b>Blah2:</b> 22<br/> <b>Blah3:</b> 33<br/> <b>Blah4:</b> 44<br/> <b>Blah5:</b> 55<br/>"; preg_match_all('|Blah([0-9]).*?([0-9]+)|',$str,$matches); $blah = array(); foreach($matches[1] as $k => $v){ $blah[$v] = $matches[2][$k]; } echo $blah[1]; //11 echo $blah[5]; //55 ?>
  8. Hmm, interesting question. I guess the the unfortunate answer is it depends how far you take things. Since people learn by the experiences they have, I guess you could argue that any thoughts/ideas they have are based on their previous experiences. That said, i would hope there are at least some complete innovations - otherwise we live in a bit of a boring world! It's difficult to think of an example of one though. Even when you consider great scientific discoveries, there's usually some influence from another scientist at some point.
  9. Probably an error in the script. Try removing any content headers and the imagejpeg function and accessing the script directly (rather than loading it in an image tag) and see if you get any errors.
  10. Ah yeah, sorry. Didn't think that one through completely. An alternative to the if statement would be the str_pad function: <?php $duration = $movie->getDuration(); $minutes = floor($duration / 60); $seconds = round($duration % 60,2); $duration = $minutes.':'.str_pad($seconds,2,'0',STR_PAD_LEFT); ?>
  11. Surely, by definition, random numbers have no pattern? Im not sure what you're asking us to help you do. Perhaps if you provide some examples we might be able to help a bit more.
  12. Regular expressions are your friend: <?php $str = 'This is the text that "was entered" in the form. More "text entered".'; preg_match_all('|"(.*?)"|',$str,$matches); foreach($matches[1] as $v){ echo 'Quote: '.$v.'<br />'; } ?> Regular expressions allow you to match/find/replace specific text against general patterns. There's a subform here which might help you understand a bit about them, or you can google.
  13. Thats quite vague. However, i guess what you're trying to achieve is something which will fit text to a certain area in your images. If so, try using the imagettfbbox which will return an array of points corresponding to the size of a text string given it's font, size and angle. I use this to reduce the length of text applied to artist and song names used in my signiture, until it fits in the space available.
  14. Well, 197 seconds is actually 3 minutes and 17 seconds. Anyways, try: <?php function convert($seconds){ $minutes = floor($seconds / 60); $seconds = round($seconds % 60,2); return $minutes.':'.$seconds; } echo convert(197.733333); ?>
  15. There are two parts to this. The first it grabbing the content. Hopefully it'll be a simple matter of using the file_get_contents() function. Then, you'll need to be using regular expressions to find your matches. There is a subforum here which might help you. Otherwise, come back with some sample data that you've managed to grab, and tell us what you're trying to retrieve.
  16. chr() is your friend: <?php foreach(range(33,126) as $v){ echo chr($v).'<br />'; } ?>
  17. I think what you're after is imagettfbbox(). You specify the text, font, and angle, and it returns an array of points showing the dimensions. Here's a snippet from the code that generates my signiture using the above function: $size = imagettfbbox(8,0,$font,$v); $width = $size[2] - $size[0]; while($width > 250){ $v = substr($v,0,strlen($v)-4).'...'; $size = imagettfbbox(8,0,$font,$v); $width = $size[2] - $size[0]; } The idea is to keep shortening the text until it fits into the space for it.
  18. Why would you want to? Perhaps you could do something prior to the the text being written on the image?
  19. Hahaha. The childish 'i know you are but what am i' seems rather appropriate.
  20. Indeed it does not. However, i feel that something from the official php website DOES constitute proof that goto is not currently planned for implementation. Furthermore, i've not actually seen anyone explicitly agree that php has goto. You say people have been postin 'as if it is true'. However, it appears to me that only you have been posting 'as if it is true'
  21. There are litterally thousands of tutorials for this on the web. There used to be one on this website, though i couldn't seem to find it last time i looked - i could only find the second part. If you google you will find plently of tutorials and examples.
  22. You can either do a join or a sub query. If you google, you'll find plently of examples.
  23. Try changing these two lines: $file = file("usercats.txt"); foreach($file as $Key => $Val){ to: $Data = file("usercats.txt"); foreach($Data as $Key => $Val){ You use the $Data variable inside you loop, but you called it $file.
  24. Did you actually bother to read the previous posts? Evidently not. Yes, I did. Did you actually bother to try not to be rude/make useless replies that contribute nothing? Funny, i was under the impression that it was you who was doing such a thing. If you did indeed bother to read the other replies you would surely have noticed that it has already been stated that the logs have been checked and show nothing.
  25. Hmm, lets try the post that directs to the minutes of the php 6 development meeting. I doupt it.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.