Technical interview questions for software engineers — languages, databases, web, cloud, DevOps, and fundamentals. Browse all topics.

  • PHP Interview Questions

  • OOP Interview Questions

  • jQuery Interview Questions

  • MySQL Interview Questions

  • JavaScript Interview Questions

  • HR Interview Questions

  • HTML Interview Questions

  • C/C++ Interview Questions

  • Showing posts with label explode php. Show all posts
    Showing posts with label explode php. Show all posts

    explode php - string to array in php

    explode php-string to array in php

    explode: converts a string into an array.

    Syntax
    explode(separator,string)

    Example:string to array in php

    <?php
    $str = "A,B,C,D";
    print_r (explode(",",$str));
    ?>


    OUTPUT:
    Array
    (
    [0] => A
    [1] => B
    [2] => C
    [3] => D
    )


    Bookmark and Share

    PHP explode() Function


    PHP explode() Function


    explode :- The explode() function split a string into an array.

    Syntax
    explode(separator,string)


    Note: Separator cannot be an empty string

    Example: explode()

    <?php


    $name= "PHP implode explode string functions";
    $arr = (" ", $name);
    print_r($arr);
    ?>


    Output:
    array([0]=>"PHP",[1]=>"implode",[2]=>"explode",[3]=>"string",[4]=>"functions");


    Bookmark and Share

    Ternary conditional operator in PHP?

    Ternary conditional operator, PHP, Question, conditional operator,ternary operator,explode php,php implode
    Ternary conditional operator:
    Expression preceding the ? is evaluated, if it’s true, then the expression preceding  the : is executed, otherwise, the expression following : is executed.


    Syntax:
    Condition ? value if true :value if false;


    Example:
    <?php
    $id = isset($_POST['name']) ?  $_POST['name'] : false;
    ?>


    Bookmark and Share