---
title: "Keywords in PHP"  
description: "Keywords in PHP"  
author: "Anonymous User"  
published: 2018-07-19  
updated: 2018-07-19  
canonical: https://www.mindstick.com/forum/34627/keywords-in-php  
category: "php"  
tags: ["web development", "php"]  
reading_time: 1 minute  

---

# Keywords in PHP

What type of [keywords](https://www.mindstick.com/articles/12899/how-to-spot-if-you-re-optimizing-for-the-wrong-keywords) in [php](https://www.mindstick.com/articles/12149/php-constant-and-php-variables) ?

## Replies

### Reply by Prakash nidhi Verma

Keywords in PHP :

1. Local:

```
<?php $x = 20;
$y = 40;
function mindstick() {
    local $x, $y;
    $y = $x + $y;
}
mindstick();
echo $y; // outputs 60
?>
```

2. global: global variable access by using this from within a function.

Example:

```
<?php $x = 5;
$y = 10; function mindstick() {
    $GLOBALS['y'] = $GLOBALS['x'] + $GLOBALS['y'];
}
mindstick();
echo $y; // outputs 15
?>
```

\

3. static: all of its variables are deleted when a function is executed.

```
<?php function mindstick() {
    static $x = 0;
    echo $x;
    $x++;
}
mindstick();
mindstick();
mindstick();
?>
```


---

Original Source: https://www.mindstick.com/forum/34627/keywords-in-php

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
