logo Online Learner
  • Home
  • Learning Paths
  • Development
    Frontend Development Backend Development
  • Study Notes
  • Free Resume Builder
  • About Us
  • Contact Us
  • Login
  • Sign Up
  1. Learning Paths
  2. Next.js Tutorial
  3. Server vs Client Components

Server vs Client Components

Server Components vs Client Components is the most important mental model in the Next.js App Router. Server Components run only on the server. Client Components run in the browser. Every component you write is one or the other, and choosing correctly affects performance, security, and user experience.

This tutorial explains what each type does, the "use client" directive, the client boundary, and how to pass data between them. You will build a page that fetches data on the server and includes a small interactive button on the client. If you are new to the App Router, read Next.js Middleware first, or start with Next.js App Router Basics if routing is still unclear.

What Are Server Components and Client Components?

Server Components are React components that run only on the server and send HTML to the browser. Client Components are React components that run in the browser and support interactivity. In the App Router, Server Components are the default. You add "use client" to opt into a Client Component .

// app/example/page.tsx
// This is a Server Component by default.
export default function ExamplePage() {
  return <h1>Rendered on the server</h1>;
}

How it works: The file has no "use client" directive, so Next.js treats it as a Server Component. It runs during the request on the server, produces HTML, and sends that HTML to the browser. No component JavaScript for this file is sent to the client unless it imports a Client Component.

What Is the "use client" Directive?

The "use client" directive marks a file and all its imports as Client Components. It must be the first statement in the file, before any imports. Once a file is a Client Component, it can use state, effects, event handlers, and browser APIs .

// app/components/Counter.tsx
"use client";

import { useState } from "react";

export default function Counter() {
  const [count, setCount] = useState<number>(0);

  return (
    <div>
      <p>Count: {count}</p>
      <button onClick={() => setCount(count + 1)}>Add one</button>
    </div>
  );
}
Browser shows:
Count: 0
[Add one]   ← clicking increments the count

How it works: The directive tells Next.js to bundle this component for the browser. The useState hook and the onClick handler require a browser environment. Without the directive, Next.js would throw an error because Server Components cannot use state or event handlers. The directive does not make the component client-only in the HTML sense. It still renders on the server for the initial HTML, then hydrates in the browser.

When Should You Use Each Type?

The choice depends on what the component needs to do. Use the table below as a quick reference.

Need Server Component Client Component
Fetch data from a database Yes No
Access secrets or API keys Yes No
Use useState or useReducer No Yes
Use useEffect No Yes
Add event handlers like onClick No Yes
Access window or localStorage No Yes
Reduce JavaScript sent to browser Yes No

How it works: Server Components keep sensitive logic and large dependencies on the server. Client Components handle anything that needs the browser. Start with Server Components and add Client Components only where interactivity is required. This keeps your bundle small and your data safe.

What Is the Client Boundary and How Does It Spread?

The client boundary is the line between server and client code. When a file has "use client", every component it imports also becomes a Client Component. The boundary spreads downward through the import tree .

// app/components/ClientParent.tsx
"use client";

import Child from "./Child";

export default function ClientParent() {
  return <Child />;
}
// app/components/Child.tsx
// No "use client" here, but it becomes a Client Component
// because it is imported by ClientParent.
export default function Child() {
  return <p>I am now a Client Component.</p>;
}

How it works: Child.tsx has no directive of its own. But because ClientParent imports it, and ClientParent is a Client Component, Child becomes part of the client bundle. The boundary does not spread upward. A Server Component can import a Client Component, but the reverse is not true for making server code.

How Do You Pass Server Components as Children into Client Components?

A Client Component cannot import a Server Component directly. But it can receive one as a children prop. The Server Component renders on the server, and the resulting HTML is passed into the Client Component .

// app/components/Collapsible.tsx
"use client";

import { useState } from "react";

export default function Collapsible({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) {
  const [open, setOpen] = useState<boolean>(false);

  return (
    <div>
      <button onClick={() => setOpen(!open)}>
        {open ? "Hide" : "Show"}
      </button>
      {open && children}
    </div>
  );
}
// app/page.tsx (Server Component)
import Collapsible from "./components/Collapsible";

export default function HomePage() {
  return (
    <Collapsible>
      <p>This content was rendered on the server.</p>
    </Collapsible>
  );
}
Browser shows:
[Show]   ← clicking reveals the server-rendered paragraph

How it works: The page is a Server Component. It renders the paragraph on the server and passes it as children to Collapsible. The Client Component controls whether to display the children, but the children themselves stay server-rendered. This pattern lets you wrap server content in interactive UI without turning the whole page into a Client Component.

Why Must Props Be Serializable?

Props passed from a Server Component to a Client Component must be serializable. That means they must be values that can cross the network boundary: strings, numbers, booleans, plain objects, arrays, and some special values like Date and Map. Functions, class instances, and Symbol values cannot be passed .

// app/page.tsx (Server Component)
import LikeButton from "./components/LikeButton";

export default function HomePage() {
  const postId = "post-123";
  return <LikeButton postId={postId} />;
}
// app/components/LikeButton.tsx
"use client";

export default function LikeButton({ postId }: { postId: string }) {
  return <button>Like {postId}</button>;
}

How it works: The string postId can be sent from server to client because it is serializable. If you tried to pass a function like onLike={() => {}} from a Server Component, Next.js would throw an error. Define functions inside the Client Component instead, or use Server Actions for mutations.

What Error Do You Get When Using useState in a Server Component?

Using a client-only hook in a Server Component produces a clear error. Next.js tells you to add the directive or move the hook into a Client Component .

// app/broken/page.tsx
import { useState } from "react";

export default function BrokenPage() {
  const [value] = useState<string>("hello");
  return <p>{value}</p>;
}
// Error: You're importing a component that needs `useState`.
// This React hook only works in a client component.
// To fix, mark the file (or its parent) with the "use client" directive.

How it works: Server Components do not have a client-side runtime, so hooks like useState and useEffect are unavailable. The fix is to either add "use client" at the top of the file or move the hook into a separate Client Component and import it. Adding the directive to the whole page works, but it turns the entire page into a Client Component. Prefer moving only the interactive part into its own small file.

Common Mistakes and Best Practices

  • Adding "use client" to every file. This turns your entire app into client code and loses the benefits of server rendering. Start without the directive and add it only where you need state, effects, event handlers, or browser APIs.
  • Importing a Server Component inside a Client Component. A Client Component cannot import a Server Component directly. Pass the Server Component as children from a parent Server Component instead. The boundary only allows server-to-client imports, not the reverse.
  • Trying to pass functions as props from server to client. Functions are not serializable. Passing them causes a runtime error. Define event handlers inside the Client Component, or use Server Actions to handle mutations on the server.
  • Fetching data in Client Components unnecessarily. Server Components can fetch data directly and keep API keys private. Use Client Components for interactivity, not for data loading that does not need to run in the browser.
  • Making large Client Components. Every Client Component adds JavaScript to the bundle. Keep Client Components small and move them to the leaves of the component tree so most of your app stays on the server.

Real-World Example: A Server-Rendered List with a Client Like Button

This example fetches a post on the server, renders it, and includes a small interactive like button on the client.

// app/components/LikeButton.tsx
"use client";

import { useState } from "react";

export default function LikeButton({ initialLikes }: { initialLikes: number }) {
  const [likes, setLikes] = useState<number>(initialLikes);

  return (
    <button onClick={() => setLikes(likes + 1)}>
      Likes: {likes}
    </button>
  );
}
// app/page.tsx (Server Component)
import LikeButton from "./components/LikeButton";

type Post = {
  id: string;
  title: string;
  likes: number;
};

async function getPosts(): Promise<Post[]> {
  // Simulated data fetch. Replace with a real API or database call.
  return [
    { id: "1", title: "Learning Server Components", likes: 12 },
    { id: "2", title: "Understanding Client Boundaries", likes: 8 },
  ];
}

export default async function HomePage() {
  const posts = await getPosts();

  return (
    <main>
      <h1>Posts</h1>
      <ul>
        {posts.map((post) => (
          <li key={post.id}>
            <h2>{post.title}</h2>
            <LikeButton initialLikes={post.likes} />
          </li>
        ))}
      </ul>
    </main>
  );
}
Browser shows:
Posts
  Learning Server Components
  [Likes: 12]   ← clicking increments to 13

  Understanding Client Boundaries
  [Likes: 8]    ← clicking increments to 9

Line-by-line explanation: LikeButton.tsx starts with "use client" because it uses useState and onClick. It accepts a number prop initialLikes, which is serializable. The page file has no directive, so it is a Server Component. The getPosts function runs on the server and returns an array of posts. The page component is async and awaits the data. It maps over the posts and renders a LikeButton for each one, passing the server-fetched like count as a prop. Only the button's JavaScript is sent to the browser. The rest of the page, including the post list and headings, stays on the server. The example is complete and compiles with TypeScript strict mode.

Summary

  • Server Components run only on the server and are the default in the App Router. Client Components run in the browser and need the "use client" directive.
  • Use Server Components for data fetching, secrets, and large dependencies. Use Client Components for state, effects, event handlers, and browser APIs.
  • The client boundary spreads downward through imports. A Server Component can import a Client Component, but a Client Component cannot import a Server Component directly.
  • Pass Server Components as children into Client Components to combine interactivity with server-rendered content.
  • Props from server to client must be serializable. Functions and class instances cannot be passed across the boundary.
  • Keep Client Components small and at the leaves of the tree to minimise the JavaScript bundle.

Now that you understand the component model, continue to SSR, SSG & ISR Explained to learn how Next.js renders pages at different times.

Frequently Asked Questions

Can a Client Component import a Server Component?

No. A Client Component cannot import a Server Component directly because the import would pull server code into the client bundle. Instead, pass the Server Component as a children prop from a parent Server Component. The Server Component renders on the server, and the resulting content is passed into the Client Component.

Why does useState fail in a Server Component?

Server Components have no client-side runtime. They run on the server, where React does not mount components or track state over time. Hooks like useState and useEffect need a browser. Next.js throws an error that tells you to add "use client" or move the hook into a Client Component.

Does "use client" mean the component never runs on the server?

No. Client Components still render on the server for the initial HTML. The directive tells Next.js to bundle the component for the browser so it can hydrate and handle interactivity. The component's server render produces the first HTML, then the browser takes over after hydration.

Can I pass a function as a prop to a Client Component?

No, not from a Server Component. Functions are not serializable, so they cannot cross the network boundary. Define event handlers inside the Client Component itself. For mutations, use Server Actions, which are designed to be called from Client Components and executed on the server.

How do I share data between a Server Component and a Client Component?

Pass the data as props from the Server Component to the Client Component. The data must be serializable, like strings, numbers, plain objects, or arrays. Fetch the data in the Server Component, then pass only what the Client Component needs. This keeps sensitive data and large dependencies on the server.

Practice Exercises

Easy: Mark a Component as Client

Create a component that uses useState to toggle between "On" and "Off". Add the correct directive.

Show solution
// app/components/Toggle.tsx
"use client";

import { useState } from "react";

export default function Toggle() {
  const [on, setOn] = useState<boolean>(false);

  return (
    <button onClick={() => setOn(!on)}>
      {on ? "On" : "Off"}
    </button>
  );
}

The "use client" directive is required because the component uses state and an event handler.

Easy: Fix the useState Error

This Server Component uses useState and fails. Fix it by moving the hook into a Client Component.

// app/broken/page.tsx
import { useState } from "react";

export default function BrokenPage() {
  const [count] = useState<number>(0);
  return <p>{count}</p>;
}
Show solution
// app/components/CounterDisplay.tsx
"use client";

import { useState } from "react";

export default function CounterDisplay() {
  const [count] = useState<number>(0);
  return <p>{count}</p>;
}
// app/fixed/page.tsx
import CounterDisplay from "../components/CounterDisplay";

export default function FixedPage() {
  return <CounterDisplay />;
}

Moving the hook into a Client Component fixes the error without making the entire page a Client Component.

Medium: Pass a Server Component as Children

Create a Client Component called Accordion that toggles visibility. Pass a server-rendered paragraph as its children from a Server Component page.

Show solution
// app/components/Accordion.tsx
"use client";

import { useState } from "react";

export default function Accordion({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) {
  const [open, setOpen] = useState<boolean>(false);

  return (
    <div>
      <button onClick={() => setOpen(!open)}>
        {open ? "Close" : "Open"}
      </button>
      {open && children}
    </div>
  );
}
// app/page.tsx
import Accordion from "./components/Accordion";

export default function HomePage() {
  return (
    <Accordion>
      <p>This paragraph was rendered on the server.</p>
    </Accordion>
  );
}

The children are server-rendered and passed into the Client Component through the children prop.

Challenge: Build a Server-Fetched List with a Client Like Button

Create a Server Component page that fetches a typed array of items. Render each item with a Client Component LikeButton that takes a numeric prop and increments on click.

Show solution
// app/components/LikeButton.tsx
"use client";

import { useState } from "react";

export default function LikeButton({ initialLikes }: { initialLikes: number }) {
  const [likes, setLikes] = useState<number>(initialLikes);

  return (
    <button onClick={() => setLikes(likes + 1)}>
      Likes: {likes}
    </button>
  );
}
// app/page.tsx
import LikeButton from "./components/LikeButton";

type Item = {
  id: string;
  name: string;
  likes: number;
};

async function getItems(): Promise<Item[]> {
  return [
    { id: "1", name: "First Item", likes: 5 },
    { id: "2", name: "Second Item", likes: 10 },
  ];
}

export default async function HomePage() {
  const items = await getItems();

  return (
    <ul>
      {items.map((item) => (
        <li key={item.id}>
          <p>{item.name}</p>
          <LikeButton initialLikes={item.likes} />
        </li>
      ))}
    </ul>
  );
}

The page stays a Server Component and fetches data. Only the button is a Client Component, keeping the bundle small.



Shaikh Abdul Shahid
Written by Shaikh Abdul Shahid

A Full-Stack Developer with experience in PHP, Laravel, JavaScript, and React.
Founder of Online Learner, sharing practical knowledge and programming tutorials.
Building and maintaining real-world web applications since 2017.

GitLab LinkedIn
X
0 likes
Your Feedback

Help us improve by sharing your thoughts.

IT and Digital Marketing
keyboard_arrow_left Previous
Next keyboard_arrow_right
Online Learner Logo

Online Learner helps developers master programming, database concepts, interview preparation, and real-world implementation through structured learning paths.

Quick Links

  • Frontend Development
  • Backend Development
  • Learning Paths
  • Notes
  • Free Resume Builder
  • Portfolio

Company

  • About Us
  • Contact Us
  • Terms & Conditions
  • Disclaimer

© 2023 - 2026 OnlineLearner.in | All Rights Reserved.

logo
  • code Frontend
  • storage Backend
  • live_help Interviews
  • work_outline PHP Frameworks
  • settings Routine Use
  • book Blogs
Frontend
  • HTML Tutorial
    • HTML Introduction
    • HTML Tags
    • HTML Elements
    • HTML Attributes
    • HTML Heading
    • HTML Paragraph
    • HTML Formatting
    • HTML Quotations
    • HTML Comments
    • HTML Styles
    • HTML Color
    • HTML CSS
    • HTML Images
    • HTML Favicon
    • HTML Links
    • HTML DIV
    • HTML Tables
    • HTML Table Size
    • HTML Table Head
    • Table Padding & Spa...
    • Table colspan rowspsn
    • HTML Table Styling
    • HTML Colgroup
    • HTML List
    • HTML Block & Inline
    • HTML Classes
    • HTML Id
    • HTML Iframes
    • HTML Head
    • HTML Layout
    • HTML Semantic Elements
    • HTML Style Guide
    • HTML Forms
    • HTML Form Attribute
    • HTML Form Element
    • HTML input type
    • HTML Computer code
    • HTML Entity
    • HTML Symbol
    • HTML Emojis
    • HTML Charset
    • HTML Input Form Att...
    • HTML URL Encoding
  • CSS Tutorial
    • CSS Introduction
    • CSS Syntax
    • CSS Selector
    • How To Add CSS
    • CSS Comments
    • CSS Colors
    • CSS Background color
    • CSS background-image
    • CSS Borders
    • CSS Margins
    • CSS Height, Width a...
    • CSS Box Model
    • CSS Outline
    • CSS Text
    • CSS Fonts
    • CSS Icon
    • CSS Links
    • CSS Tables
    • CSS Display
    • CSS Maximum Width
    • CSS Position
    • z-index Property
  • JavaScript Tutorial
    • What is JavaScript
    • JS Syntax
    • JS Variables
    • JS Data Types
    • JS Operators
    • JS Control Flow - IF
    • JS Control Flow - S...
    • JS Control Flow - Loop
    • JS Function
    • JS Object Methods
    • JS Anonymous Funct...
    • JS Recursive Function
    • JS Default Parameters
    • JS this Keyword
    • What is an Array in...
    • What are JavaScript...
    • Error Handling in J...
    • DOM Selection in Ja...
    • DOM Traversal in Ja...
    • Manipulating Elemen...
    • Event Handling in J...
    • JavaScript Event Li...
    • JavaScript Event Pr...
    • Form Handling in Ja...
    • Dynamic Styling in ...
    • JavaScript DOM Elem...
    • Window Object in Ja...
    • What is Local Storage?
    • Regular Expressions...
  • Jquery Tutorial
    • What is jQuery?
    • Benefits of using j...
    • Include jQuery
    • Selectors.
    • Methods.
    • The $ symbol and sh...
    • Selecting elements
    • Getting and setting...
    • Adding and removing...
    • Modifying CSS and c...
    • Binding and Unbindi...
    • Common events: clic...
    • Event delegation
    • Using .on() for dyn...
    • Showing and hiding ...
    • Fading elements in ...
    • Sliding elements up...
    • .animate()
    • Understanding AJAX
    • .ajax()
    • .load(), .get(), .p...
    • Handling responses ...
    • Parent
    • Chlid
    • Siblings
    • Filtering Elements
    • Using find
    • Selecting form elem...
    • Getting form values
    • Setting form values
    • Form validation
    • Handling form submi...
    • jQuery plugins
    • Sliders plugins
    • $.each()
    • $.trim()
    • $.extend()
    • Data attributes
    • Debugging jQuery code
  • Bootstrap 4
    • What is Bootstrap
    • Benefits of using
    • Setting up
    • Container
    • Row and Column
    • Grid Classes
    • Breakpoints
    • Offsetting Columns
    • Column Ordering
    • Basic Typography
    • Text Alignment
    • Text colors
    • Backgrounds
    • Display
    • Font Size Utilities
    • Buttons
    • Navs and Navbar
    • Forms
    • Cards
    • Alerts
    • Badges
    • Progress Bars
    • Margin
    • Padding
    • Sizing
    • Flexbox
    • Dropdowns
    • Modals
    • Tooltips
    • Popovers
    • Collapse
    • Carousel
    • Images
    • Tables
    • Jumbotron
    • Media Object
  • Git
    • Understanding Versi...
    • Download and Instal...
    • Git Configure
    • Git Initialize
    • Add Changes to Staging
    • Commit Changes
    • Branching
    • Merging
    • Remote Repository
    • Understanding Git C...
    • Stashing Changes
    • Viewing Commit History
    • Undoing Changes
  • Ajax Tutorial
    • Ajax Fundamentals
    • Ajax Working
    • XMLHttpRequest Fetch
    • Synchronous vs Asyn...
    • Ajax Advantages
    • Ajax Disadvantages
    • $.ajax() method
    • Ajax GET request
    • Ajax POST Request
    • Json Response
    • Ajax Errors
    • Ajax Form
  • React Tutorial
    • What is React? Begi...
    • React Environment S...
    • React Fundamentals:...
    • Functional vs Class...
    • Props in React Expl...
    • State and setState ...
    • React Event Handling
    • React Conditional R...
    • React Lists and Keys
    • Styling in React In...
    • Styling in React Us...
    • Styling in React Us...
    • Tailwind CSS with R...
    • Tailwind vs CSS Mod...
    • React Hooks
    • React useState Hook
    • React useEffect Hook
    • React useRef Hook
    • React useContext Hook
    • React useReducer Hook
    • Custom Hooks in React
    • React Router – In...
    • Installing React Ro...
    • React Router – Ro...
    • React Router – Ne...
    • React Router URL Pa...
    • React Router Protec...
    • React Router Redire...
    • State Management in...
    • Redux State Managem...
    • Redux Toolkit Expla...
    • Redux Toolkit vs Re...
    • Controlled vs Uncon...
    • Handling Form Input...
    • API Integration in ...
    • Axios in React – ...
    • Handling Loading an...
    • Async Await in Java...
    • Displaying API Data...
    • CRUD Operations in ...
    • React Performance O...
    • React Performance O...
  • Tailwind
    • Introduction to Tai...
    • Utility-First CSS E...
    • Tailwind CSS vs Boo...
    • When and Why to Use...
    • Real-World Use Case...
    • Tailwind CSS Instal...
    • Installing Tailwind...
    • Tailwind CSS with V...
    • Setting Up Tailwind...
    • Install Tailwind CS...
    • Tailwind CSS Colors...
    • Tailwind CSS Backgr...
    • Tailwind CSS Paddin...
    • Tailwind CSS Margin...
    • Tailwind CSS Width ...
    • Tailwind CSS Height...
    • Tailwind CSS Border...
    • Tailwind CSS Border...
    • Tailwind CSS Text S...
    • Tailwind CSS Box Sh...
    • Tailwind CSS Opacit...
    • Tailwind CSS Cursor...
    • Tailwind CSS Overfl...
    • Tailwind CSS Font S...
    • Tailwind CSS Font W...
    • Tailwind CSS Text A...
    • Tailwind CSS Line H...
    • Tailwind CSS Letter...
    • Tailwind CSS Text T...
    • How to Use Google F...
    • Flexbox with Tailwi...
    • Justify Content in ...
    • Align Items in Tail...
    • Flex Direction in T...
    • Gap in Tailwind CSS...
    • Flexbox with Tailwi...
    • Grid System in Tail...
    • Grid System in Tail...
    • Responsive Design i...
    • Positioning & Z-Ind...
    • Background Colors i...
    • Background Images i...
    • Gradients in Tailwi...
    • Image Object-Fit in...
    • Image Overlay Effec...
    • Buttons in Tailwind...
    • Hover & Focus State...
    • Buttons and Forms i...
    • Cards and Sections ...
    • Navbar and Footer D...
  • TypeScript Tutorial
    • TypeScript Introduc...
    • TypeScript Installa...
    • First TypeScript Pr...
    • TypeScript Basic Types
    • Type Inference and ...
    • TypeScript Arrays a...
    • TypeScript Enums
    • TypeScript Any, Unk...
    • TypeScript Interfaces
    • Type Aliases and Un...
    • Intersection Types
    • Literal Types
    • Functions in TypeSc...
    • Classes in TypeScript
    • Access Modifiers an...
    • Abstract Classes
    • TypeScript Generics
    • TypeScript Utility ...
    • Type Guards and Nar...
    • Modules and Namespaces
    • TypeScript Decorators
    • TypeScript with React
    • TypeScript with Nod...
  • Next.js Tutorial
    • Introduction to Nex...
    • Next js Setup and P...
    • Next js App Router ...
    • Next js Pages and L...
    • Next js Navigation ...
    • Next js Dynamic Routes
    • Next js Route Groups
    • Next js Middleware
    • Server vs Client Co...
    • SSR, SSG and ISR Ex...
    • Next js Loading and...
Backend
  • PHP Tutorial
    • PHP Introduction
    • PHP Installation
    • PHP Syntax
    • PHP Comments
    • PHP Variable
    • PHP Echo
    • PHP Data Types
    • PHP Strings
    • PHP Constant
    • PHP Maths
    • PHP Number
    • PHP Operators
    • PHP if else & if el...
    • PHP Switch
    • PHP Loops
    • PHP Functions
    • PHP Array
    • PHP OOps
    • PHP Class & Object
    • PHP Constructor
    • PHP Destructor
    • PHP Access Modfiers
    • PHP Inheritance
    • PHP Final Keyword
    • PHP Class Constant
    • PHP Abstract Class
    • PHP Superglobals
    • PHP Regular Expression
    • PHP Interfaces
    • PHP Static Method
    • PHP Static Properties
    • PHP Namespace
    • PHP Iterable
    • PHP Form Introduction
    • PHP Form Validation
    • PHP Complete Form
    • PHP Date and Time
    • PHP Include Files
    • PHP - Files & I/O
    • File Upload
    • PHP Cookies
    • PHP SESSION
    • PHP Filters
    • PHP Callback Functions
    • PHP JSON
    • PHP AND Exceptions
    • PHP Connect database
  • PHP Functions
    • strlen
    • strtoupper
    • strtolower
    • ucfirst
    • ucwords
    • substr
    • str_replace
    • strpos
    • trim in php
    • explode
    • implode
    • count in php
    • array_merge
    • array_push
    • array_pop
    • array_shift
    • array_unshift
    • in_array
    • array_keys
    • array_values
    • array_filter
    • array_map
    • sort
    • asort
    • ksort
    • abs
    • round
    • ceil
    • floor
    • rand
    • mt_rand
    • max
    • min
    • pow
    • sqrt
    • date
    • time
    • strtotime
    • mktime
    • date_diff
    • getdate
    • fopen
    • fread
    • fwrite
    • fclose
    • file_get_contents
    • file_put_contents
    • file_exists
    • unlink
    • filesize
    • is_readable
    • is_writable
    • urlencode
    • urldecode
    • parse_url
    • http_build_query
    • isset
    • empty
    • is_numeric
    • is_array
    • is_string
    • filter_var
    • htmlspecialchars
    • md5
    • sha1
    • password_hash
    • password_verify
    • die
    • exit
    • var_dump
    • print_r
    • include
    • require
    • json_encode
    • json_decode
    • sleep
  • PHP and MySQL Functions
    • mysqli_connect
    • mysqli_select_db
    • mysqli_query
    • mysqli_prepare
    • mysqli_stmt_execute
    • mysqli_multi_query
    • mysqli_fetch_assoc
    • mysqli_fetch_array
    • mysqli_fetch_row
    • mysqli_fetch_object
    • mysqli_num_rows
    • mysqli_real_escape_...
    • mysqli_insert_id
    • mysqli_affected_rows
    • mysqli_error
    • mysqli_close
    • mysqli_commit
    • mysqli_rollback
  • Python Tutorial
    • What is Python?
    • Install Python on W...
    • Install Python on L...
    • Install Python on m...
    • IDE Setup
    • Python syntax
    • Python Comments
    • Python Indentation
    • Python Variables
    • Python Data Types
    • Python Numeric
    • Python Boolean
    • Python String
    • Python List
    • Python Tuple
    • Python Range
    • Python Dictionary
    • Python Arithmetic O...
    • Python Assignment O...
    • Python Comparison O...
    • Python Logical Oper...
    • Python Bitwise Oper...
    • Python if condition
    • Python if else cond...
    • Python For Loop
    • Python While Loop
    • Python break, conti...
  • MYSQL
    • SQL Introduction
    • Syntax
    • Select statement
    • Select Distinct
    • WHERE Clause
    • Order By
    • SQL AND Operator
    • SQL OR Operator
    • SQL NOT Operator
    • SQL LIKE
    • SQL IN
    • SQL BETWEEN
    • SQL INSERT INTO
    • SQL NULL Values
    • SQL UPDATE
    • SQL DELETE
    • SQL TOP, LIMIT, FET...
    • SQL MIN() and MAX()...
    • SQL COUNT() Function
    • SQL SUM()
    • SQL AVG()
    • SQL Aliases
    • SQL JOIN
    • SQL INNER JOIN
    • SQL LEFT JOIN
    • SQL RIGHT JOIN
    • SQL FULL OUTER JOIN
    • SQL Self Join
    • SQL UNION
    • SQL GROUP BY
    • SQL HAVING
    • SQL EXISTS
    • SQL ANY and ALL
    • SQL SELECT INTO
    • SQL INSERT INTO SELECT
    • SQL CASE
    • SQL NULL Functions
    • SQL Stored Procedures
    • SQL Comments
    • SQL Operators
    • SQL CREATE DATABASE
    • SQL DROP DATABASE
    • SQL BACKUP DATABASE
    • SQL CREATE TABLE
    • SQL DROP TABLE
    • SQL ALTER TABLE
    • SQL Constraints
    • SQL NOT NULL
    • SQL UNIQUE Constraint
    • SQL PRIMARY KEY
    • SQL FOREIGN KEY
    • SQL CHECK Constraint
    • SQL CREATE INDEX
    • SQL AUTO INCREMENT
    • SQL Dates
    • SQL Views
    • SQL Injection
    • SQL Hosting
    • SQL Data Types
  • Node Js
    • What is Node.js?
    • Why use Node.js?
    • Installing Node.js
    • First Node.js progr...
    • Event Loop
    • Understanding npm
    • What are Modules?
    • fs (File System)
    • Http Module
    • Path Module
    • Creating custom mod...
    • Exporting and impor...
    • Setting up a basic ...
    • Handling requests a...
    • Serving HTML
    • Serving CSS
    • Serving JavaScript
  • Python MySQL
    • Database Connection
    • Table Creation
    • Insert Query
    • Select Query
    • Update Query
    • Delete Query
    • Where Clause Query
    • Limit Clause Query
    • Join Tables
    • Order By Query
    • Group By Query
    • Aggregate Functions
    • Parameterized Query
  • Java Tutorials
    • Java Introduction
    • Java Installation
    • Java Syntax
    • Java Comments
    • Java Variables
    • Java DataTypes
    • Java Operators
    • Java Conditionals
    • Java Looping
    • Java Arrays
    • Java Methods
    • Java Classes
    • Java Objects
    • Java Constructors
    • Java Inheritance
    • Java Polymorphism
    • Java Encapsulation
    • Java Abstraction
    • Java Exception
    • Java Interfaces
    • Java File Handling
    • Java Threads
    • Java Access Modifiers
    • Java Static Keyword
    • Java Final Keyword
    • Java Nested Class
    • Java Synchronization
  • Docker
    • Introduction to Docker
    • Installing Docker
    • Docker Architecture
    • Docker Images
    • Docker Containers
    • Dockerfile Basics
    • Docker Volumes
    • Docker Networking
    • Docker Compose
    • Docker Hub & Registry
    • Multi-Stage Builds
    • Docker with Nginx
    • Docker with MySQL
    • Docker with PHP & L...
    • Docker Environment ...
    • Docker Logs & Debug...
    • Docker Security Bes...
    • Docker Swarm Basics
    • Docker vs Virtual M...
    • Real World Docker P...
Interviews
  • PHP Interviews
    • What is PHP?
    • What does PHP stand...
    • PHP Advantages
    • Difference between ...
    • Start a PHP script?
    • Commenting in PHP
    • Variable in PHP
    • Different types of ...
    • Different types of ...
    • Array in PHP
    • Difference between ...
    • Retrieve data from ...
    • PHP handle errors
    • Sessions in PHP
    • PHP Cookie
    • What are the main f...
    • What are the differ...
    • What are the differ...
  • Java Interview Questions
    • Java Basics – Wha...
    • What is the differe...
    • What are the OOP co...
    • Why is the main met...
    • What are the differ...
    • What is the differe...
    • What is Method Over...
    • What is the Differe...
    • What is the Constru...
    • What are the Access...
    • What is the this Ke...
    • What is the super K...
    • What is the static ...
    • What is the final K...
    • What is Exception H...
    • What are Checked an...
    • What is the Differe...
    • What are Multithrea...
    • What is the Java Co...
    • What is the Differe...
    • What is the Differe...
    • What is the Differe...
    • What is the Differe...
    • How Does HashMap Wo...
    • What is the Differe...
    • What is the Differe...
    • What is the String ...
    • What is the Differe...
    • What is Garbage Col...
    • What is the Differe...
    • What is a Lambda Ex...
    • What is the Stream ...
    • What are Optional C...
    • What is the Differe...
    • What are the Key Fe...
    • What is the Record ...
  • React Interviews
    • What is React.js
    • Help In Interviews
    • Features of React
    • What is JSX
    • React's Virtual DOM
    • State and Props
    • React handle data b...
    • React Component
    • setState() method.
    • Controlled Components
    • Lifecycle Methods
    • Significance of keys
    • What are the differ...
  • Laravel Interviews
    • What is Laravel?
    • What are the key fe...
    • Explain the concept...
    • What is a controlle...
    • What is Blade templ...
    • How does Eloquent O...
    • Explain the concept...
    • What are middleware...
    • How do you create a...
    • What is CSRF protec...
    • What is the purpose...
    • What is the purpose...
    • Explain the concept...
    • How do you create a...
    • What is the purpose...
    • How do you define r...
    • What are named rout...
    • Explain the use of ...
    • What is the purpose...
    • What are service pr...
  • SQL Interviews
    • What is SQL?
    • What are the differ...
    • What is the differe...
    • What is a primary key?
    • What is a foreign key?
    • What are the differ...
    • What is the differe...
    • What is the use of ...
    • What is the differe...
    • What is an index in...
    • What types of index...
    • What is a subquery?
    • How do you use the ...
    • How can you find th...
    • Explain the use of ...
    • What is a view?
    • What are the limita...
    • Write a query to fe...
    • Write a query to fe...
    • Write a query to co...
    • Write a query to fe...
    • Write a query to fe...
    • Write a query to fi...
    • Write a query to fe...
    • Write a query to re...
    • Write a query to ge...
    • Write a query to ge...
    • Write a query to li...
    • Write a query to fi...
    • Write a query to fi...
    • Write a query to ge...
    • Write a query to fi...
    • Write a query to co...
    • Write a query to fi...
    • Write a query to li...
    • Write a query to fe...
    • Write a query to fi...
    • Write a query to fe...
    • Write a query to ge...
    • Write a query to co...
    • Write a query to fe...
  • JavaScript Interview Questions
    • What Exactly is Jav...
    • What are the data t...
    • What is the differe...
    • JavaScript double e...
    • What is a Closure i...
    • What is Hoisting in...
    • Understanding "this...
    • What Are JavaScript...
    • Null vs Undefined i...
    • How Does JavaScript...
    • What is a Promise i...
    • Async/Await in Java...
    • Event Delegation in...
    • JavaScript Modules ...
    • How to Prevent a Fu...
    • JavaScript Intervie...
    • JavaScript Intervie...
    • What is bind() in J...
    • Event Bubbling vs. ...
    • Deep Copy vs Shallo...
    • What is the new Key...
PHP Frameworks
  • Laravel
    • Laravel Topics
    • Laravel 7 Installation
    • Install laravel 8
    • Laravel 8 Routing
    • Laravel Controllers
    • Views and Blade lar...
    • Database and Eloque...
    • Authentication and ...
    • CSRF Protection
    • Laravel Model
    • Database: Query Bui...
Routine Use
  • Linux
    • How to Delete a Fil...
    • Install lemp in ubu...
    • How to check packag...
    • Navigating the File...
    • Managing Files and ...
    • Viewing and Editing...
    • Managing Processes ...
    • Scheduling Tasks wi...
    • Disk Usage Analysis...
    • File and Directory ...
Blogs
  • Blogs
    • Free Hosting on AWS...
    • PHP 8.6 Partial Fun...
    • What is SEO?
    • Zoho Free Mail
    • Speed Up Your Appli...
    • What is a JavaScrip...
    • Laravel vs Lumen: T...
    • MySQL vs PostgreSQL...
    • Automate Free MySQL...
    • How to Use Google A...
    • What is n8n?
    • Cloud Platform Comp...
    • Top Common Mistakes...
    • PHP 8.5: The Pipeli...
    • Google Antigravity ...
    • How to Optimize Que...
    • React vs Angular vs...
    • Base44: Features, P...
    • Difference Between ...
    • HTTP Status Codes E...
    • Build Native Mobile...
    • Top 10 JavaScript F...
    • JIRA, Waterfall, an...
    • WebSockets in Moder...
    • A Complete Real-Wor...
    • Why Developers Shou...
    • Service-Based Compa...
    • Bootstrap vs Tailwi...
    • Direct Prompt vs St...
    • Top 25 SEO HTML Tag...
    • Docker Commands Che...
    • Authentication vs A...
    • Top AI Portals in 2...
    • What is Replit? Com...
    • Laravel 13 Released...
    • NEET Paper Leak Pre...