Revision as of 04:19, 27 March 2023 edit27.96.195.4 (talk)No edit summary← Previous edit |
Latest revision as of 17:01, 8 November 2024 edit undoPeaceray (talk | contribs)Autopatrolled, Administrators94,381 editsm Rollback edit(s) by 1.37.88.45 (talk): test edits (RW 16.1)Tags: RW Rollback |
(17 intermediate revisions by 12 users not shown) |
Line 1: |
Line 1: |
|
{{Skip to talk}} |
|
{{Skip to talk}} |
|
{{Talk header|noarchive=yes|search=no}} |
|
{{Talk header|noarchive=yes|search=no}} |
|
{{Vital article|topic=Technology|level=5|link=Misplaced Pages:Vital articles/Level/5/Technology|anchor=Programming languages (43 articles)|class=GA}} |
|
|
{{Article history |
|
{{Article history |
|
|action1=PR|action1date=09:46, 23 February 2008|action1link=Misplaced Pages:Peer review/PHP/archive1|action1result=reviewed|action1oldid=193456805 |
|
|action1=PR|action1date=09:46, 23 February 2008|action1link=Misplaced Pages:Peer review/PHP/archive1|action1result=reviewed|action1oldid=193456805 |
Line 7: |
Line 6: |
|
|action3=GAN|action3date=11:11, 1 April 2008 (UTC)|action3link=Talk:PHP/Archive 6#Good article nomination|action3result=listed|action3oldid=202315889 |
|
|action3=GAN|action3date=11:11, 1 April 2008 (UTC)|action3link=Talk:PHP/Archive 6#Good article nomination|action3result=listed|action3oldid=202315889 |
|
|topic=engtech |
|
|topic=engtech |
|
|currentstatus=GA |
|
|
|otd1date=2007-06-08|otd1oldid=136768480 |
|
|otd1date=2007-06-08|otd1oldid=136768480 |
|
|otd2date=2008-06-08|otd2oldid=217767227 |
|
|otd2date=2008-06-08|otd2oldid=217767227 |
Line 15: |
Line 13: |
|
|otd6date=2015-06-08|otd6oldid=665966658 |
|
|otd6date=2015-06-08|otd6oldid=665966658 |
|
|otd7date=2020-06-08|otd7oldid=961374169 |
|
|otd7date=2020-06-08|otd7oldid=961374169 |
|
}} |
|
|
{{WikiProjectBannerShell|1= |
|
|
{{WikiProject Computing|class=GA|importance=high|free-software=yes|free-software-importance=High|software=yes}} |
|
|
{{WikiProject Computer science|class=GA|importance=high}} |
|
|
{{WikiProject Internet|class=GA|importance=high}} |
|
|
|
|
|
|
|
|action4 = GAR |
|
{{WikiProject Software|class=GA|importance=mid}} |
|
|
|
|action4date = 22:40, 12 February 2024 (UTC) |
|
{{WikiProject Spoken Misplaced Pages|En-PHP.ogg|462166234}} |
|
|
|
|action4link = Misplaced Pages:Good article reassessment/PHP/1 |
|
|
|action4result = delisted |
|
|
|action4oldid = 1206545484 |
|
|
|currentstatus = DGA |
|
|
}} |
|
|
{{WikiProject banner shell|class=C|vital=yes|1= |
|
|
{{WikiProject Computing|importance=High|free-software=yes|free-software-importance=High|software=yes}} |
|
|
{{WikiProject Computer science|importance=high}} |
|
|
{{WikiProject Internet|importance=high}} |
|
|
{{WikiProject Software|importance=mid}} |
|
|
{{WikiProject Spoken Misplaced Pages}} |
|
}} |
|
}} |
|
|
|
|
{{Merged-from|Visibility of PHP properties and methods|08:41, July 28, 2010}} |
|
{{Merged-from|Visibility of PHP properties and methods|08:41, July 28, 2010}} |
|
{{Merged-from|PHP Data Objects|date=July 15, 2014}} |
|
{{Merged-from|PHP Data Objects|date=July 15, 2014}} |
Line 38: |
Line 41: |
|
{{archives|search=yes|bot=MiszaBot I|age=100}} |
|
{{archives|search=yes|bot=MiszaBot I|age=100}} |
|
|
|
|
|
|
==GA Reassessment== |
|
== Using Type Declaration instead of Type Hints == |
|
|
|
{{Misplaced Pages:Good article reassessment/PHP/1}} |
|
|
|
|
As my change has been reverted it seems appropriate to discuss the matter. |
|
|
|
|
|
The PHP documentations refers to them as Type declaration, see: https://www.php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration, and the original RFC introducing scalar types, uses the word "declaration", see: https://wiki.php.net/rfc/scalar_type_hints_v5 |
|
|
Although it is true that the PHP 5 documentation referred to them as "hints", and that the "Object Typehint" RFC is named as such but for all intent and purposes it is a type declaration. |
|
|
|
|
|
Moreover, the word "declaration" is used in other places correctly instead of "hint", see: |
|
|
|
|
|
{{quote|text=PHP 7 also included new language features. Most notably, it introduces return type ''declarations'' for functions which complement the existing parameter type ''declarations'', and support for the scalar types (integer, float, string, and boolean) in parameter and return type ''declarations''.}} |
|
|
|
|
|
{{quote|text=Unusually for a dynamically typed language, PHP supports type ''declarations'' on function parameters, which are enforced at runtime. This has been supported for classes and interfaces since PHP 5.0, for arrays since PHP 5.1, for "callables" since PHP 5.4, and scalar (integer, float, string and boolean) types since PHP 7.0. PHP 7.0 also has type ''declarations'' for function return types, expressed by placing the type name after the list of parameters, preceded by a colon. For example, the getAdder function from the earlier example could be annotated with types like so in PHP 7:}} |
|
|
|
|
|
{{quote|text=By default, scalar type ''declarations'' follow weak typing principles.}} |
|
|
|
|
|
(Emphasis mine) |
|
|
|
|
|
As I'm new to contributing to Misplaced Pages, I don't know what to do about the following comment from the revert commit |
|
|
{{quote|text="typehint" is the commonly used term in the community.}} |
|
|
|
|
|
As sure it is referred to that but it is not accurate, and my understanding is that Misplaced Pages articles should be accurate. |
|
|
|
|
|
Can someone more experienced clarify? |
|
|
|
|
|
== Syntax highlighting == |
|
|
|
|
|
The <code>syntaxhighlight</code> tag does not support modern PHP syntax: |
|
|
<syntaxhighlight lang="php"> |
|
|
$person = new class |
|
|
{ |
|
|
public $firstName = "John"; |
|
|
public $lastName = "Smith"; |
|
|
|
|
|
public function name(){ |
|
|
return "$this->firstName $this->lastName"; |
|
|
} |
|
|
}; |
|
|
</syntaxhighlight> |
|
|
or |
|
|
<syntaxhighlight lang="php"> |
|
|
class MyClass |
|
|
{ |
|
|
public string $var1; |
|
|
|
|
|
public array $var2; |
|
|
|
|
|
function pr(string|int $array, array|null $subj): float|false |
|
|
{ |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
$myObj->pr(subj: , array: "John"); |
|
|
|
|
|
</syntaxhighlight> |
|
|
] (]) 17:10, 25 January 2021 (UTC) |
|
|
|
|
|
== Dropping legacy file extensions == |
|
|
|
|
|
The infobox currently has this for file extensions: |
|
|
|
|
|
php, phtml, php3, php4, php5, php7, phps, php-s, pht, phar |
|
|
|
|
|
Some of these are extremely rare to see in the wild, like <code>php3</code>. I am wondering if it would make sense to drop these from the infobox, so we are left with just the common ones (roughly sorted by how common): |
|
|
|
|
|
php, phar, phps, phtml |
|
|
|
|
|
And then perhaps we have a line somewhere in the article that explains why you might come across something like <code>.php3</code> in a legacy system? Modern PHP just does not have all these silly extensions. |
|
|
|
|
|
] (]) 09:13, 3 May 2021 (UTC) |
|
|
|
|
|
== SampleCode replaces Screenshot in this type of Infobox == |
|
|
|
|
|
{{ping|Ancarda}} Hi, SampleCode argument is new and it should be used is instead of the past argument "screenshot". See, SampleCode has an abstract description of the total programming style. It conveys important information about remaining parts of this Infobox. So we should use this argument as the second rendering item, to successfully convey an overview of PHP language. Thanks, ] (]) 12:22, 3 February 2022 (UTC) |
|
|
:Dear {{ping|Peterl}} Please read the above paragraph. By the same reason, perhaps we should apply that for Java and Javascript. If you disagree, please discuss that here. Thanks, ] (]) 17:55, 3 February 2022 (UTC) |
|
|
|
|
|
{{ping|Hooman Mallahzadeh}}. Interesting, it seems some languages have sample code in a screenshot, I wasn't aware of that. I had a look through the Wayback Machine and it seems the PHP article never did. Nevertheless, the article has many code snippets, e.g. https://en.wikipedia.org/PHP#Example demonstrates OOP, string concatenation, list usage (<code></code>, <code>foreach</code>), closures & functional programming (<code>array_walk</code>), string interpolation, and one style of comments (<code>//</code>). |
|
|
|
|
|
I appreciate the infobox might support a snippet to give a feel of the language, but just having hello world there doesn't seem useful to me. Perhaps it's useful to other people, I'm not sure. I especially feel this as https://en.wikipedia.org/PHP#Syntax gives two different ways to accomplish hello world. I honestly think a screenshot is fine -- is that deprecated for accessibility reasons? It seems like you'd have to put a lot of text there to make it useful (which you can't fit into the infobox), or somehow make it expand (like an image does today when you click on it). |
|
|
|
|
|
Do a lot of other languages have this? I will admit I reverted your edit because I had seen previous similar edits reverted too, e.g. https://en.wikipedia.org/search/?title=JavaScript&diff=next&oldid=1069635829&diffmode=source |
|
|
] (]) 05:47, 5 February 2022 (UTC) |
|
|
::{{ping|Ancarda}} I have a question: What comes at the first glance in your mind when you hear the word "PHP"? For myself at the first glance is a small program like "Hello world", that is a typical instance of the total concept of programming language PHP. What about you? ] (]) 06:34, 5 February 2022 (UTC) |
|
|
:::{{ping|Ancarda}} Or a better guestion: How you would explain the concept of PHP language to a bachelor student at his first term? Perhaps you would use a simple example, and not explain items like "Paradigm", "type discipline", and others. OK? Here we use "Hello World" program at Infobox to introduce PHP for a person who does not have any skill in programming. ] (]) 06:40, 5 February 2022 (UTC) |
|
|
|
|
|
---- |
|
|
|
|
|
{{ping|Hooman Mallahzadeh}} |
|
|
|
|
|
''For myself at the first glance is a small program like "Hello world", that is a typical instance of the total concept of programming language PHP'' |
|
|
|
|
|
I'm not sure what you mean by total concept. Printing something to the console doesn't seem to demonstrate enough differences between programming languages. Just from hello world, what differences can you see between these two languages: |
|
|
|
|
|
<syntaxhighlight lang="python"> |
|
|
print("hello world") |
|
|
</syntaxhighlight> |
|
|
|
|
|
<syntaxhighlight lang="haskell"> |
|
|
main = putStrLn "hello world" |
|
|
</syntaxhighlight> |
|
|
|
|
|
It looks like you can just substitute some function calls <code>print -> putStrLn</code> and change the syntax slightly (i.e. drop parens) to translate Python into Haskell... but you can't. These snippets miss a very important fact that <code>print</code> has side-effects and <code>putStrLn</code> actually returns an <code>IO ()</code>, i.e. it's monadic. It also misses the fact Python is primarily a scripting language, and so many programs will use <code>__name__</code> so the programs functions can be included without executing. PHP works this way too; code outside functions will execute immediately. |
|
|
|
|
|
If we want to give a "feel" for what these languages are like, we could expand the example, which will surface many of the differences: |
|
|
|
|
|
<syntaxhighlight lang="python"> |
|
|
import sys |
|
|
|
|
|
def main(): |
|
|
print("Type something to have it printed back") |
|
|
for line in sys.stdin: |
|
|
print(line, end = "") |
|
|
|
|
|
if __name__ == "__main__": |
|
|
main() |
|
|
</syntaxhighlight> |
|
|
|
|
|
vs. |
|
|
|
|
|
<syntaxhighlight lang="haskell"> |
|
|
printInput :: IO () |
|
|
printInput = getLine >>= (\x -> putStrLn x) >> printInput |
|
|
|
|
|
main :: IO () |
|
|
main = |
|
|
putStrLn "Type something to have it printed back" >> |
|
|
printInput |
|
|
</syntaxhighlight> |
|
|
|
|
|
Do you see how different the languages look just by doing something slightly more complicated than printing a fixed string to standard out? The issue I have is these snippets are now too large to put in the infobox -- again, my question is why we're replacing the screenshot with a snippet. It seems like a step back to me. If it was discussed and established somewhere, then please let me know (i.e. link me to the decision). If not (i.e. this is your proposal), I really don't see the value. Sorry. |
|
|
|
|
|
''Here we use "Hello World" program at Infobox to introduce PHP for a person who does not have any skill in programming'' |
|
|
|
|
|
I've always had the impression Misplaced Pages is a reference for people who already know quite a bit about the topic they are reading up on, i.e. Misplaced Pages is not the place to go for an introduction to a topic. Perhaps I'm mistaken. ] (]) 11:37, 5 February 2022 (UTC) |
|
|
|
|
|
== Security == |
|
|
Graphics processing is a rapidly developing field, so what was 'current' even only recently could be outdated very quickly. Additionally, describing GPU capability by monetary cost isn't particularly descriptive, even if one assumes USD pricing. |
|
The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.