Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121602 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 54117 invoked from network); 6 Nov 2023 14:47:54 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 6 Nov 2023 14:47:54 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A505B1804D0 for ; Mon, 6 Nov 2023 06:47:53 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-yw1-f176.google.com (mail-yw1-f176.google.com [209.85.128.176]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 6 Nov 2023 06:47:53 -0800 (PST) Received: by mail-yw1-f176.google.com with SMTP id 00721157ae682-5b383b4184fso54526697b3.1 for ; Mon, 06 Nov 2023 06:47:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699282072; x=1699886872; darn=lists.php.net; h=in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=hzXnEwQ5aJtprVOCldkQWq92Z+9ZeVZkNpM5O1xef8Q=; b=bqTGXOzjB7DV/tROVPUmiaYwNoy/YKW6Rdu3TM7FUtPr76Q+prFAFBFR5qrEiqeupt CJ8aqwzw0HiM/P4MObMceFwec0FUSaMe8TTZgTs3gEnd3gQsGOcue6ChyMP5VMPfvVPA VajInD5kmT0VD3BRH18gBjouJTRV/brpGHTcId2sBY2xyEWRSZM70sS8OPErsQQT2hNx QNosDkijFVQIA1+l5LRSVsM2nTjHZ0junqEGzMi+C4y7zG1KDmg8qOiSaV+BfGfsyYpd 78IZPAskx3OZg0Lfx0/lDa0IUJ/d4W5MNFfV51uiY2gaRkYnbHpL/5ejI0+az0dR86dk h9eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699282072; x=1699886872; h=in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=hzXnEwQ5aJtprVOCldkQWq92Z+9ZeVZkNpM5O1xef8Q=; b=eGwIX5n3+PDGuNiiVitUQIs+rxn5mh0dMcbqYoa1a0TM9bko/vGVzCchcxSp/sGFay oQvSSpQGQLwOnvW/utLdXfYzElSiIK5gGnF44NnyPlayZWAY8tpHh+7x8LBxHrjz6vhm CE86aD4rR+RiAv1cwzc2wu5aZSh6zJOs/cr+3uismyhkjTNQDx3IMxMDcf5qEG9jToLP 4ZL5ceVTIwCtqFggQfr2G+uvkG7aayznVF2RdIQ6Df1X7rJ/koX20VLp8mfSzOwzhGZw XwS0Qq5qNLJ5TI72pEgdj0K815Obwbinp/wYDklibsN+PEnkC3MqJdWZtVvIzJzi9L79 FTJg== X-Gm-Message-State: AOJu0Ywlvi45odr71twqQdOGfIHdOQwpxzqzh0Ukcedh0fAwwDkfDdO4 CKnegNXTo8ymbL9lQff0pNXnwxGSmyQ= X-Google-Smtp-Source: AGHT+IGrY5F//xJ2ETW/qVr8Wsx0yQaPInFzS6YkdTnOMC7nAGKxK6IZJhjHZii3a1PiBrBfcR9u0g== X-Received: by 2002:a81:9813:0:b0:5a7:be61:d52b with SMTP id p19-20020a819813000000b005a7be61d52bmr9327127ywg.24.1699282072204; Mon, 06 Nov 2023 06:47:52 -0800 (PST) Received: from [10.25.25.21] ([45.174.128.1]) by smtp.gmail.com with ESMTPSA id r133-20020a819a8b000000b0059f650f46b2sm4365516ywg.7.2023.11.06.06.47.51 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 06 Nov 2023 06:47:51 -0800 (PST) Content-Type: multipart/alternative; boundary="------------wE2vTJFLDrkbHXMVAAiWTnrF" Message-ID: <767c301c-de2e-49e7-94af-70858bd7baf5@gmail.com> Date: Mon, 6 Nov 2023 11:47:49 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: internals@lists.php.net References: Content-Language: en-US In-Reply-To: Subject: Re: [PHP-DEV] [Discussion] Variable Type Declaration Before Usage From: marcolindev@gmail.com (Marcos Marcolin) --------------wE2vTJFLDrkbHXMVAAiWTnrF Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit > Local based variable declaration before usage is available in most > languages like javascript, python, and many more. php has this, but it's > only available while working/dealing with oop related. Hello Oladoyinbo, I'll contribute an observation, correct me if I'm wrong. In Python or Javascript it is not possible to declare types, as they are dynamic languages, similar to PHP. What you can do in Python is write type annotations, but it doesn't change its type at run time. ```python myVar: int = 5; print(myVar); # The output is 5 myVar = 'Marcos'; print(myVar); # The way out is Marcos myVar = True; print(myVar); # The output is True ``` As for Javascript, it doesn't even have type annotations, you need to use `JSDoc` to document, or use `Typescript` to use types. Hug. --- Marcos Marcolin Software Engineer | PHP www.marcosmarcolin.com.br --------------wE2vTJFLDrkbHXMVAAiWTnrF--