Booleans ¶ This is the simplest type. A bool expresses a truth value. It can be either TRUE or FALSE. Syntax ¶ To specify a bool literal, use the constants TRUE or FALSE. Both are case-insensitive. Typically, the result of an operator which returns a bool value is passed on to a control structure. Converting to boolean ¶ To explicitly convert a value to bool, use the (bool) or (boolean) casts. However, in most cases the cast is unnecessary, since a value will be automatically converted if an operator, function or control structure requires a bool argument. See also Type Juggling. When converting to bool, the following values are considered FALSE: the boolean FALSE itself the integers 0 and -0 (zero) the floats 0.0 and -0.0 (zero) the empty string, and the string “0” an array with zero elements the special type NULL (including unset variables) SimpleXML objects created from empty…
-
-
Types of PHP variables
Booleans ¶ This is the simplest type. A bool expresses a truth value. It can be either TRUE or FALSE. Syntax ¶ To specify a bool literal, use the constants TRUE or FALSE. Both are case-insensitive.$foo = True; // assign the value TRUE to $foo?> Typically, the result of an operator which returns a bool value is passed on to a control structure. Converting to boolean ¶ To explicitly convert a value to bool, use the (bool) or (boolean) casts. However, in most cases the cast is unnecessary, since a value will be automatically converted if an operator, function or control structure requires a bool argument. See also Type Juggling. When converting to bool, the following values are considered FALSE: the boolean FALSE itself the integers 0 and -0 (zero) the floats 0.0 and -0.0 (zero) the empty string, and the string “0” an array with zero elements the special type NULL (including unset variables) SimpleXML objects created from empty…
-
Comments in PHP
PHP supports ‘C’, ‘C++’ and Unix shell-style (Perl style) comments. For example: The “one-line” comment styles only comment to the end of the line or the current block of PHP code, whichever comes first. This means that HTML code after // ... ?> or # ... ?> WILL be printed: ?> breaks out of PHP mode and returns to HTML mode, and // or # cannot influence that. This is an example The header above will say 'This is an example'. ‘C’ style comments end at the first */ encountered. Make sure you don’t nest ‘C’ style comments. It is easy to make this mistake if you are trying to comment out a large block of code.
-
Using the Python Interpreter
Source: Python.org The Terms ‘Interactive’ and ‘Shell’ The term “interactive” traces back to the Latin expression “inter agere”. The verb “agere” means amongst other things “to do something” and “to act”, while “inter” denotes the spatial and temporal position to things and events, i.e. “between” or “among” objects, persons, and events. So “inter agere” means “to act between” or “to act among” these. With this in mind, we can say that the interactive shell is between the user and the operating system (e.g. Linux, Unix, Windows or others). Instead of an operating system an interpreter can be used for a programming language like Python as well. The Python interpreter can…
-
Virtualenv
Source: VirtualEnv virtualenv is a tool to create isolated Python environments. Since Python 3.3, a subset of it has been integrated into the standard library under the venv module. The venv module does not offer all features of this library, to name just a few more prominent: is slower (by not having the app-data seed method), is not as extendable, cannot create virtual environments for arbitrarily installed python versions (and automatically discover these), is not upgrade-able via pip, does not have as rich programmatic API (describe virtual environments without creating them). The basic problem being addressed is one of dependencies and versions, and indirectly permissions. Imagine you have an application that needs version 1 of LibFoo, but another application requires version 2.…
-
PHP tags
When PHP parses a file, it looks for opening and closing tags, which are and ?> which tell PHP to start and stop interpreting the code between them. Parsing in this manner allows PHP to be embedded in all sorts of different documents, as everything outside of a pair of opening and closing tags is ignored by the PHP parser. PHP includes a short echo tag which is a short-hand to the more verbose PHP also allows for short open tag (which is discouraged since it is only available if enabled using the short_open_tag php.ini configuration file directive, or if PHP was configured with the –enable-short-tags option). If a file contains only PHP code, it is preferable to omit…
-
Best Python Frameworks
What do Python programmers need to make their life easier? The answer is frameworks. By automating the implementation of redundant tasks, frameworks cut development time and enable developers to focus greatly on application logic rather than routine elements. Because it is one of the leading programming languages, there is no scarcity of frameworks for Python. Different frameworks have their own set of advantages and issues. Hence, the selection needs to be made on the basis of project requirements and developer preference. There are primarily three types of Python frameworks, namely full-stack, micro-framework, and asynchronous. Before moving onto discussing the best Python frameworks to go for in 2020, let’s first take a…
-
Popular PHP Frameworks For Web Development in 2020
Today, you can see a lot of advertising in which the company makes a landmark for 2020. The beginning of a new decade always marks a big change. For example, the first iPad appeared exactly at the start of 2010. It was a huge step forward in the development of tablets and computer technology in general. Source: https://merehead.com/People are waiting from 2020 something supernatural, although it remains quite a bit. In fact, the near future of web development is already known today. Some trends appeared a year earlier. What are Best PHP Frameworks to use in 2020? Here is the list of the Best PHP Frameworks to use in 2020 are: Laravel Symfony Code…
-
What is Python? Powerful, intuitive programming
Why the Python programming language shines for data science, machine learning, systems automation, web and API development, and more Source: Infoworld.comDating from 1991, the Python programming language was considered a gap-filler, a way to write scripts that “automate the boring stuff” (as one popular book on learning Python put it) or to rapidly prototype applications that will be implemented in other languages. However, over the past few years, Python has emerged as a first-class citizen in modern software development, infrastructure management, and data analysis. It is no longer a back-room utility language, but a major force in web application creation and systems management, and a key driver of the explosion in big…
-
Your First PHP page
Create a file named helloworld.php and put it in your web server’s root directory (DOCUMENT_ROOT) with the following content: Example #1 Our first PHP script: helloworld.php Use your browser to access the file with your web server’s URL, ending with the /helloworld.php file reference. When developing locally this URL will be something like http://localhost/helloworld.php or http://127.0.0.1/helloworld.php but this depends on the web server’s configuration. If everything is configured correctly, this file will be parsed by PHP and the following output will be sent to your browser: This program is extremely simple and you really did not need to use PHP to create a page like this. All it does is display: Hello World using the PHP echo statement. Note that the file does not…