Jump to content

Archived

This topic is now archived and is closed to further replies.

extrovertive

PHP version 50

Recommended Posts

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....

Share this post


Link to post
Share on other sites
[quote author=extrovertive link=topic=109038.msg439239#msg439239 date=1158915919]
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....
[/quote]

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?

Share this post


Link to post
Share on other sites
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;
}

Share this post


Link to post
Share on other sites
[quote author=onlyican link=topic=109038.msg440124#msg440124 date=1159051102]
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;
}
[/quote]

Well, technically, it'd be

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

but yes, that is correct. :)

Share this post


Link to post
Share on other sites
Actually it would be more like...

[code=php:0]
function nl2br($str) {
  $str = str_replace("\n","<br />\n",$str);
  return $str;
}
[/code]

as linefeads are not actually replaced.

Share this post


Link to post
Share on other sites
[quote author=thorpe link=topic=109038.msg440687#msg440687 date=1159157512]
Actually it would be more like...

[code=php:0]
function nl2br($str) {
  $str = str_replace("\n","<br />\n",$str);
  return $str;
}
[/code]

as linefeads are not actually replaced.
[/quote]

gah! I stand corrected.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Not even then - thorpe's is correct. If mine was correct, then if you ran nl2br on this:

[code]asdf
qwer[/code]

it would come out as:

[code]asdf<br />qwer[/code]

However, in actuality, it comes out as:

[code]asdf<br />
qwer[/code]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
[quote author=extrovertive link=topic=109038.msg439239#msg439239 date=1158915919]
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....
[/quote]

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
care to share your definitions of "Web Programming" and "Real Programming"?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
[quote author=thorpe link=topic=109038.msg441036#msg441036 date=1159200568]
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.
[/quote]

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

Share this post


Link to post
Share on other sites

×

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.