Programming Articles

Page 1079 of 2547

bindec() function in PHP

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 162 Views

The bindec() function converts a binary number to its decimal equivalent. It takes a binary string as input and returns the corresponding decimal value. Syntax bindec(binary_string) Parameters binary_string − The binary string to convert. Must contain only 0s and 1s. Return Value The bindec() function returns the decimal value of the specified binary string. If the input contains invalid characters, it stops processing at the first invalid character. Examples Basic Conversion Here's a simple example converting binary to decimal ? 13 ...

Read More

base_convert() function in PHP

Samual Sam
Samual Sam
Updated on 15-Mar-2026 176 Views

The base_convert() function converts a number from one base to another, for example, octal number to decimal number. The base mentioned here should be between 2 and 36. Digits in numbers with a base greater than 10 are represented with the letters a-z, where a is 10, b is 11, c is 12, d is 13, and so on up to z which is 35. Syntax base_convert(num, original_base, to_base) Parameters num − The number to convert (as a string) original_base − The original base of the number (between 2 and 36) to_base − ...

Read More

atan2() function in PHP

Samual Sam
Samual Sam
Updated on 15-Mar-2026 184 Views

The atan2() function in PHP returns the arc tangent of two variables. It calculates the angle in radians between the positive x-axis and the ray from the origin to the point (val2, val1). Syntax atan2(y, x) Parameters y − The y-coordinate (dividend) x − The x-coordinate (divisor) Return Value The atan2() function returns the arc tangent of y/x in radians. The returned value is between -π and π, which represents the angle from the positive x-axis to the point (x, y). Example 1 Basic usage with positive values ...

Read More

What are the differences between JavaScript and PHP cookies?

Anvi Jain
Anvi Jain
Updated on 15-Mar-2026 905 Views

Cookies are text files stored on the client's browser to remember user information across web pages. Both JavaScript and PHP can work with cookies, but they operate differently − JavaScript handles cookies on the client-side while PHP manages them on the server-side. JavaScript Cookies JavaScript cookies are manipulated directly in the browser using the document.cookie property. They're ideal for client-side data storage and immediate user interactions. Setting a Cookie with JavaScript // Set a cookie that expires in 7 days document.cookie = "username=john; expires=" + new Date(Date.now() + 7*24*60*60*1000).toUTCString() + "; path=/"; Reading ...

Read More

How to pass JavaScript variables to PHP?

Johar Ali
Johar Ali
Updated on 15-Mar-2026 21K+ Views

You can pass JavaScript variables to PHP using several methods. Since PHP runs on the server and JavaScript runs in the browser, direct variable passing isn't possible. However, you can achieve this through AJAX requests, form submissions, or by embedding JavaScript values in PHP output. Method 1: Using AJAX POST Request The most common approach is to send JavaScript variables to PHP using AJAX − Pass JS to PHP Send Data to PHP ...

Read More

How to call Python file from within PHP?

SaiKrishna Tavva
SaiKrishna Tavva
Updated on 15-Mar-2026 11K+ Views

In PHP, you can execute Python scripts using built-in functions like shell_exec(), exec(), or proc_open(). Each method offers different levels of control over the process. Using shell_exec() The simplest approach − runs a command via the shell and returns the output as a string. Use escapeshellcmd() to sanitize the command ? The square of 4 is 16 Specifying the Python Interpreter If the script lacks a shebang line (#!/usr/bin/env python3), explicitly call the interpreter ? The square of 5 is 25 ...

Read More

Is there something available in Python like PHP autoloader?

Sumana Challa
Sumana Challa
Updated on 15-Mar-2026 484 Views

No, Python does not have a direct equivalent to PHP's autoloader, and it doesn't need one. The two languages handle module loading fundamentally differently. Why PHP Needs Autoloaders PHP starts a fresh process for each web request, loading all code from scratch every time. Autoloaders optimize this by loading classes only when they are first used, avoiding the cost of loading unnecessary files on every request. Why Python Doesn't Need One Python imports modules once when the application starts. The module stays in memory (sys.modules) for the lifetime of the app. Subsequent requests reuse the already-loaded ...

Read More

How to get the POST values from serializeArray in PHP?

Ricky Barnes
Ricky Barnes
Updated on 15-Mar-2026 3K+ Views

The jQuery serializeArray() method serializes form elements into a JSON array of name-value pairs. When sent via $.post(), PHP receives these values through the $_REQUEST or $_POST superglobal. PHP Backend (serialize.php) This file receives and displays the POST values ? jQuery Frontend (HTML) The form collects user data and sends it using serializeArray() ? $(document).ready(function() { $("#driver").click(function(event) ...

Read More

How to access a collection in MongoDB using Python?

Priya Mishra
Priya Mishra
Updated on 15-Mar-2026 1K+ Views

MongoDB is a well-known NoSQL database that offers a scalable and flexible approach to store and retrieve data. Using Python with MongoDB enables developers to interact with database collections effortlessly through the PyMongo library. This article explains how to access a MongoDB collection using Python, covering the required steps, syntax, and techniques for connecting to, querying, and manipulating data. Syntax from pymongo import MongoClient # Connect to MongoDB client = MongoClient('mongodb://localhost:27017/') # Access database and collection db = client.database_name collection = db.collection_name # Perform operations collection.insert_one(document) collection.find(query) collection.update_one(filter, update) collection.delete_one(filter) PyMongo ...

Read More

SignUp form using Node and MongoDB

Mayank Agarwal
Mayank Agarwal
Updated on 15-Mar-2026 4K+ Views

In this article, we will create a simple user sign-up form using Node.js and MongoDB. When users fill out the form and click submit, their details will be saved to the MongoDB database. Installation Before creating the sign-up form, install the following dependencies: Express - Web framework for Node.js to handle HTTP requests npm install express --save Body-parser - Middleware to parse HTTP POST data npm install body-parser --save Mongoose - MongoDB ...

Read More
Showing 10781–10790 of 25,466 articles
Advertisements