| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9
Comments:
<0> but thanks for your intval help. <0> it works <0> but for consistency i will add it <1> @php $i = "2006"; $i++; echo "$i\n"; $j = "abcd"; $j++; echo $j; <2> Result: 2007 <2> abce <1> hrm <1> @php $i = "2009"; $i++; echo "$i"; <2> Result: 2010 <0> MADE A function that takes three params, value, label, select-value ... if select-value == value, creates selected option, otherwise returns normal option <0> love functions! <1> mkay.. guess it's safe. not advised, but safe <1> sofresh: if the values are all unique, you could use an ***ociative array to p*** and it could do the loop and return all the markup of options <0> what do you mean? <0> i will show you my code: <0> http://pastebin.com/736553
<0> in my newbie opinion its pretty tight - but you be the judge <3> Ugh <1> could be a one liner.. but i'd prefer a 3 or 4 liner <0> i havent ever used functions in php <0> what do you mean? <0> dont you think that code is tight, no redundant logic? <0> statements that is <1> return "<option value=\"$value\" " . ($value == $selectvalue)?' selected="selected"':'') . ">$label</option>\n"; <3> well, it's good at separating individual things into small components. <1> you DO have redundant statements <3> if that's what you're asking. <1> that 1 liner is pushing it... this is what you could have done more readibly: <0> ok, i will read what you said, but answer me this, what redundant statements do i havE? <1> $val = "<option value=\"$value\""; <1> if ($value == $selectvalue) $val .= ' selected="selected"'; <1> return "$val>$label</option>\n"; <1> your return statements are identical. redundancy <1> the majority of your ***ignment statements' contents are identical. redundancy <1> defining a variable to immediately return it, redundant <1> well, i'm off. nite all <0> two-bits hold on <0> wanna show you the change <0> actually fck i <0> it <0> i like my version better, easier for the dumb cnt to understand in future! <0> well maybe not <0> hey how do you hide a value wtihin a button submit? <0> ok, say i wanted a submit button with label: submit <0> named = "button1" <0> i want to send a value with this button <4> you use a hidden field <0> nah no good <5> can I use 2 CSS files in 1 html document? <6> ya <4> finally, i get this **** working <4> :/ <0> hey even though method=get ... why does its end vars via url? <0> can i not hide this? <4> use POST <5> is there a way to include a php file with the post data? <7> holla folks <7> any experts here ??? i need guide to cl*** OOP in php <7> i always used google... but little bit borred, coz long time to interactive :D <8> uh <9> smoke your greens! <10> how i can display the flour value of a float ? <10> floor* <11> Kingfisher: you could never guess the function name. <11> it's so complex. <11> i don't think it's even in the manual!! <11> such an unobvious function <11> @floor <2> (PHP 3, PHP 4, PHP 5) <2> float floor ( float value ) <2> Round fractions down <2> http://www.php.net/floor <11> oh wait, holy crap, it's the most obvious function of them all!! <11> and apparently it IS in the manual!! <10> hehe <10> echo"<td><img border="0" src="a.gif" width="16" height="16"></td>";
<10> why it doesnt work <1> because you have to escape your quotes <1> echo"<td><img border="" src="a.gif" width="16" height="16"></td>"; <1> php thinks the underlined is your string, and doesn't know wtf the rest is, do you see why? <10> ooooh okay <10> thanks. <12> w3rd <13> http://BitSpyder.net is a pure E-Learning tracker.. sharing only educational and informative materials. <12> who gives a **** <10> echo "<td>$i+1</td>"; .... it displays as it is , eg. 0+1 , why it doesnt shows sum value? i tried with quotes also <12> "<td>" . $i+1 . "</td>"; <10> ah.thanks alot. <10> huh..it doesnt work.. <12> intval($i + 1) <10> ok <10> yeah it works..thanks. <10> can i display only the extension of a file ? <12> ill be damned if i remember how <10> :$ <14> morning <12> Kingfisher: whos to say the file will actually have an extension anyways <10> just wanted to know <10> whats wrong with it ? strtoupper(substr($file, strrpos($file, '.')+1)); <12> you could regex it <10> regex? <1> @php $file = "file.php"; echo strtoupper(substr($file, strrpos($file, '.')+1)); <2> Result: PHP <1> whatta ya mean what's wrong? <10> nothing , i was using it in a loop and i doubted it displayed some wrong extension of some files <8> Kingfisher i use explode =.=' <1> if the files have an extension, that should certainly work <8> :D <12> but the file can contain periods inside of the name also <10> right <1> follower: that's why you take the last element with explode. it's unnecessary <1> what you have, Kingfisher, is in my opinion the best way to go if you add a strpos check to make sure it has a period at all <12> and some files wont have extensions at all <12> mmhmm <1> @php $file = "filewithnoext"; echo strtoupper(substr($file, strrpos($file, '.')+1)); <2> Result: ILEWITHNOEXT <1> which is just crap <1> regex might be the cleanest in code just as long as you actually know what you're regex is doing <10> 66. f2.php 0Kb EED2HTML <10> 32. date3.php 8Kb TXT <14> hrm <1> @php $file = "file.php"; if (preg_match('/\.(.*?)$/', $file, $m)) { $ext = $m[1]; } else { $ext = "no ext"; } echo $strtoupper($ext); <2> PHP Fatal error: Function name must be a string <1> rawr <1> @php $file = "file.php"; if (preg_match('/\.(.*?)$/', $file, $m)) { $ext = $m[1]; } else { $ext = "no ext"; } echo strtoupper($ext); <2> Result: PHP <1> @php $file = "filephp"; if (preg_match('/\.(.*?)$/', $file, $m)) { $ext = $m[1]; } else { $ext = "no ext"; } echo strtoupper($ext); <2> Result: NO EXT <10> um. <10> whats regrex? <14> !php $file = "blehblah.foo"; preg_match("/\.(.{3})/i",$file,$result); echo $result[1]; <15> foo <1> not all extensions are 3 letters. though mine should prolly say .+? instead <14> yea <1> and you have no alpha chars in your pattern. no need for case insensitivity <14> just habit <12> k, golf time. see ya <14> ok there tiger. <12> where else can you get drunk and drive without getting pulled over <12> speaking of, i need to find a baseball bat <10> @php basename <14> @basename <2> (PHP 3, PHP 4, PHP 5) <2> string basename ( string path [, string suffix] ) <2> Returns filename component of path <2> http://www.php.net/basename <14> !php $file="index.html"; echo basename($file); <15> index.html
Return to
#php or Go to some related
logs:
annkhien #allnitecafe friendship bangalorean
#chat-world mns 7 #chat-world #php #india #vb #india
|
|