Jump to content


Photo

PHP version 50


  • Please log in to reply
15 replies to this topic

#1 extrovertive

extrovertive
  • Members
  • PipPipPip
  • Advanced Member
  • 235 posts

Posted 22 September 2006 - 09:05 AM

As more and more functions are built-into PHP with new releases, there will be only several functions to use when it gets to version 50...

createmybusiness_site(title, pages)

createmyhome_page()

and more....

#2 neylitalo

neylitalo
  • Staff Alumni
  • Advanced Member
  • 1,854 posts
  • LocationMichigan, USA

Posted 23 September 2006 - 08:34 AM

As more and more functions are built-into PHP with new releases, there will be only several functions to use when it gets to version 50...

createmybusiness_site(title, pages)

createmyhome_page()

and more....


If you're saying that they'll start integrating the functionality of PHP into a few simple functions that'll do it all for you, then I certainly hope not. (I also disagree.) You would lose all flexibility, and I'm sure the people responsible for PHP have no desire to do that. They don't benefit from it, we don't benefit from it, the users don't benefit from it. All that and the fact that PHP would be quite and completely useless.

Or am I missing something?
http://nealylitalo.net - My personal website, and home of The Netizen's Journal.

#3 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 23 September 2006 - 10:38 PM

the new functions added in PHP are standard function that use php programmers have created, now php have

For example
A basic example would be nl2br()
That is basicly sayig

function nl2br($str){
$str = str_replace("\n", "<br>\n", $str);
return $str;
}
Tell me the problem, I will try tell you the solution

#4 neylitalo

neylitalo
  • Staff Alumni
  • Advanced Member
  • 1,854 posts
  • LocationMichigan, USA

Posted 24 September 2006 - 05:13 AM

the new functions added in PHP are standard function that use php programmers have created, now php have

For example
A basic example would be nl2br()
That is basicly sayig

function nl2br($str){
$str = str_replace("\n", "<br>\n", $str);
return $str;
}


Well, technically, it'd be

str_replace("\n", "<br />", $str);

but yes, that is correct. :)
http://nealylitalo.net - My personal website, and home of The Netizen's Journal.

#5 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 25 September 2006 - 04:11 AM

Actually it would be more like...

function nl2br($str) {
  $str = str_replace("\n","<br />\n",$str);
  return $str;
}

as linefeads are not actually replaced.

#6 neylitalo

neylitalo
  • Staff Alumni
  • Advanced Member
  • 1,854 posts
  • LocationMichigan, USA

Posted 25 September 2006 - 05:15 AM

Actually it would be more like...

function nl2br($str) {
  $str = str_replace("\n","<br />\n",$str);
  return $str;
}

as linefeads are not actually replaced.


gah! I stand corrected.
http://nealylitalo.net - My personal website, and home of The Netizen's Journal.

#7 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 25 September 2006 - 05:36 AM

The snippet neylitalo showed is correct if it is saved as a Linux/UNIX file. If it is saved on Windows or Macintosh it isn't.

#8 neylitalo

neylitalo
  • Staff Alumni
  • Advanced Member
  • 1,854 posts
  • LocationMichigan, USA

Posted 25 September 2006 - 05:38 AM

Not even then - thorpe's is correct. If mine was correct, then if you ran nl2br on this:

asdf
qwer

it would come out as:

asdf<br />qwer

However, in actuality, it comes out as:

asdf<br />
qwer

http://nealylitalo.net - My personal website, and home of The Netizen's Journal.

#9 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 25 September 2006 - 04:09 PM

yeah. nl2br doesnt replace new lines, merely adds a <br /> tag before it. However, Daniel0 is also partly correct in that windows, Linux and Mac all handle newlines differently. To replacate this function you'd need to use regular expressions which Im freaking hopeless at.

#10 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 25 September 2006 - 04:59 PM

This is going slighly off topic tho

I just used it as an example for saying php are only adding "common" functions, not functions such as "buildmeawebsite()"

I cant count the amount of times I have gone to build functions, and someone says, use this function by php
Tell me the problem, I will try tell you the solution

#11 448191

448191
  • Staff Alumni
  • Advanced Member
  • 3,545 posts
  • LocationNetherlands

Posted 25 September 2006 - 08:55 PM

As more and more functions are built-into PHP with new releases, there will be only several functions to use when it gets to version 50...

createmybusiness_site(title, pages)

createmyhome_page()

and more....


Not likey? Switch to assembly. Better yet, why not code binary, maybe you'll consider that 'real' programming.

#12 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,017 posts

Posted 25 September 2006 - 11:24 PM

When I started programming you had to physically rewire pathways from the input to the storage registers and then to output and check for conditions to throw switches to reroute he wiring though a different route.

Thats real programming! All this digital stuff is a piece of cake compared to that.

And yes, in case of power failure, I have an abacus in the office.
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#13 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 25 September 2006 - 11:37 PM

Dont kill me hear
I dont considor PHP "Real Programming"
I love php, but I considor it Web Programming, not Real Programming

PHP is famous for the following reasons
Affordable (Well its Free)
Easy to learn
Easy to understand
Great Resources around for it
Tell me the problem, I will try tell you the solution

#14 neylitalo

neylitalo
  • Staff Alumni
  • Advanced Member
  • 1,854 posts
  • LocationMichigan, USA

Posted 26 September 2006 - 10:16 AM

care to share your definitions of "Web Programming" and "Real Programming"?
http://nealylitalo.net - My personal website, and home of The Netizen's Journal.

#15 448191

448191
  • Staff Alumni
  • Advanced Member
  • 3,545 posts
  • LocationNetherlands

Posted 26 September 2006 - 02:36 PM

Yes, while on the subject, what is 'real'... How about the fork you're holding, is that real?  :P

Whahahahahhahhaaaa.... This kind of pointless discussions can break me up sometimes, pardon my sense of humor... ;D
"The Matrix IV:  Web programming, is it real?" Whahahahahahhaha....

I guess next someone is going to say php is a scripting laguange, and programming and scripting is soooooooooo much two different things... And don't say programming is something 'lower level', because programming my remote control isn't exactly considered lower level... WHAHAHAAHA.... :P

Go on, I could use another good laugh...

Phewey, I break myself up... Time to catch my breath.  :D

#16 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 26 September 2006 - 03:34 PM

yeah. nl2br doesnt replace new lines, merely adds a <br /> tag before it. However, Daniel0 is also partly correct in that windows, Linux and Mac all handle newlines differently. To replacate this function you'd need to use regular expressions which Im freaking hopeless at.


This function would do it.
<?php
function my_nl2br($string)
{
	return preg_replace("/(\r\n|\r|\n)/","<br />",$string);
}
?>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users